bca6c7fe385b1a27757c032c9aabedaab291a441
[nonrtric/plt/sme.git] / servicemanager / internal / invokermanagement / invokermanagement_test.go
1 // -
2 //
3 //              ========================LICENSE_START=================================
4 //              O-RAN-SC
5 //              %%
6 //        Copyright (C) 2023-2024: OpenInfra Foundation Europe
7 //              %%
8 //              Licensed under the Apache License, Version 2.0 (the "License");
9 //              you may not use this file except in compliance with the License.
10 //              You may obtain a copy of the License at
11 //
12 //                   http://www.apache.org/licenses/LICENSE-2.0
13 //
14 //              Unless required by applicable law or agreed to in writing, software
15 //              distributed under the License is distributed on an "AS IS" BASIS,
16 //              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 //              See the License for the specific language governing permissions and
18 //              limitations under the License.
19 //              ========================LICENSE_END===================================
20 package invokermanagement
21
22 import (
23         "fmt"
24         "net/http"
25         "os"
26         "strings"
27         "testing"
28
29         "oransc.org/nonrtric/servicemanager/internal/common29122"
30         "oransc.org/nonrtric/servicemanager/internal/envreader"
31         "oransc.org/nonrtric/servicemanager/internal/invokermanagementapi"
32         "oransc.org/nonrtric/servicemanager/internal/kongclear"
33         "oransc.org/nonrtric/servicemanager/internal/providermanagement"
34         provapi "oransc.org/nonrtric/servicemanager/internal/providermanagementapi"
35         "oransc.org/nonrtric/servicemanager/internal/publishservice"
36         publishapi "oransc.org/nonrtric/servicemanager/internal/publishserviceapi"
37
38         "github.com/deepmap/oapi-codegen/pkg/middleware"
39         "github.com/deepmap/oapi-codegen/pkg/testutil"
40         "github.com/labstack/echo/v4"
41         echomiddleware "github.com/labstack/echo/v4/middleware"
42         log "github.com/sirupsen/logrus"
43         "github.com/stretchr/testify/assert"
44 )
45
46 var requestHandler *echo.Echo
47
48 func TestMain(m *testing.M) {
49         err := setupTest()
50         if err != nil {
51                 return
52         }
53
54         ret := m.Run()
55         if ret == 0 {
56                 teardown()
57         }
58         os.Exit(ret)
59 }
60
61 func setupTest() error {
62         myEnv, myPorts, err := envreader.ReadDotEnv()
63         if err != nil {
64                 log.Fatal("error loading environment file on setupTest")
65                 return err
66         }
67
68         requestHandler, err = getEcho(myEnv, myPorts)
69         if err != nil {
70                 log.Fatal("getEcho fatal error on setupTest")
71                 return err
72         }
73         err = teardown()
74         if err != nil {
75                 log.Fatal("getEcho fatal error on teardown")
76                 return err
77         }
78
79         return err
80 }
81
82 func getProvider() provapi.APIProviderEnrolmentDetails {
83         var (
84                 domainInfo  = "Kong"
85                 funcInfoAPF = "rApp Kong as APF"
86                 funcInfoAEF = "rApp Kong as AEF"
87         )
88
89         testFuncs := []provapi.APIProviderFunctionDetails{
90                 {
91                         ApiProvFuncInfo: &funcInfoAPF,
92                         ApiProvFuncRole: provapi.ApiProviderFuncRoleAPF,
93                         RegInfo: provapi.RegistrationInformation{
94                                 ApiProvPubKey: "APF-PublicKey",
95                         },
96                 },
97                 {
98                         ApiProvFuncInfo: &funcInfoAEF,
99                         ApiProvFuncRole: provapi.ApiProviderFuncRoleAEF,
100                         RegInfo: provapi.RegistrationInformation{
101                                 ApiProvPubKey: "AEF-PublicKey",
102                         },
103                 },
104         }
105         return provapi.APIProviderEnrolmentDetails{
106                 RegSec:         "sec",
107                 ApiProvDomInfo: &domainInfo,
108                 ApiProvFuncs:   &testFuncs,
109         }
110 }
111
112 func teardown() error {
113         log.Trace("entering teardown")
114
115         t := new(testing.T) // Create a new testing.T instance for teardown
116
117         // Delete the invoker
118         invokerInfo := "invoker a"
119         invokerId := "api_invoker_id_" + strings.Replace(invokerInfo, " ", "_", 1)
120
121         result := testutil.NewRequest().Delete("/api-invoker-management/v1/onboardedInvokers/"+invokerId).Go(t, requestHandler)
122         assert.Equal(t, http.StatusNoContent, result.Code())
123
124         // Delete the original published service
125         apfId := "APF_id_rApp_Kong_as_APF"
126         apiName := "apiName"
127         apiId := "api_id_" + apiName
128
129         result = testutil.NewRequest().Delete("/published-apis/v1/"+apfId+"/service-apis/"+apiId).Go(t, requestHandler)
130         assert.Equal(t, http.StatusNoContent, result.Code())
131
132         // Delete the first published service
133         apfId = "APF_id_rApp_Kong_as_APF"
134         apiName = "apiName1"
135         apiId = "api_id_" + apiName
136
137         result = testutil.NewRequest().Delete("/published-apis/v1/"+apfId+"/service-apis/"+apiId).Go(t, requestHandler)
138         assert.Equal(t, http.StatusNoContent, result.Code())
139
140         // Delete the second published service
141         apiName = "apiName2"
142         apiId = "api_id_" + apiName
143
144         result = testutil.NewRequest().Delete("/published-apis/v1/"+apfId+"/service-apis/"+apiId).Go(t, requestHandler)
145         assert.Equal(t, http.StatusNoContent, result.Code())
146
147         // Delete the provider
148         domainID := "domain_id_Kong"
149         result = testutil.NewRequest().Delete("/api-provider-management/v1/registrations/"+domainID).Go(t, requestHandler)
150         assert.Equal(t, http.StatusNoContent, result.Code())
151
152         myEnv, myPorts, err := envreader.ReadDotEnv()
153         if err != nil {
154                 log.Fatal("error loading environment file")
155                 return err
156         }
157
158         err = kongclear.KongClear(myEnv, myPorts)
159         if err != nil {
160                 log.Fatal("error clearing Kong on teardown")
161         }
162         return err
163 }
164
165 func TestRegisterValidProvider(t *testing.T) {
166         teardown()
167
168         newProvider := getProvider()
169
170         // Register a valid provider
171         result := testutil.NewRequest().Post("/api-provider-management/v1/registrations").WithJsonBody(newProvider).Go(t, requestHandler)
172         assert.Equal(t, http.StatusCreated, result.Code())
173
174         var resultProvider provapi.APIProviderEnrolmentDetails
175         err := result.UnmarshalBodyToObject(&resultProvider)
176         assert.NoError(t, err, "error unmarshaling response")
177 }
178
179 func TestPublishUnpublishService(t *testing.T) {
180         apfId := "APF_id_rApp_Kong_as_APF"
181         apiName := "apiName"
182         newApiId := "api_id_" + apiName
183
184         myEnv, myPorts, err := envreader.ReadDotEnv()
185         assert.Nil(t, err, "error reading env file")
186
187         testServiceIpv4 := common29122.Ipv4Addr(myEnv["TEST_SERVICE_IPV4"])
188         testServicePort := common29122.Port(myPorts["TEST_SERVICE_PORT"])
189
190         assert.NotEmpty(t, testServiceIpv4, "TEST_SERVICE_IPV4 is required in .env file for unit testing")
191         assert.NotZero(t, testServicePort, "TEST_SERVICE_PORT is required in .env file for unit testing")
192
193         // Check no services published
194         result := testutil.NewRequest().Get("/published-apis/v1/"+apfId+"/service-apis").Go(t, requestHandler)
195         assert.Equal(t, http.StatusOK, result.Code())
196
197         // Parse JSON from the response body
198         var resultServices []publishapi.ServiceAPIDescription
199         err = result.UnmarshalJsonToObject(&resultServices)
200         assert.NoError(t, err, "error unmarshaling response")
201
202         // Check if the parsed array is empty
203         assert.Zero(t, len(resultServices))
204
205         aefId := "AEF_id_rApp_Kong_as_AEF"
206         namespace := "namespace"
207         repoName := "repoName"
208         chartName := "chartName"
209         releaseName := "releaseName"
210         description := fmt.Sprintf("Description,%s,%s,%s,%s", namespace, repoName, chartName, releaseName)
211
212         newServiceDescription := getServiceAPIDescription(aefId, apiName, description, testServiceIpv4, testServicePort)
213
214         // Publish a service for provider
215         result = testutil.NewRequest().Post("/published-apis/v1/"+apfId+"/service-apis").WithJsonBody(newServiceDescription).Go(t, requestHandler)
216         assert.Equal(t, http.StatusCreated, result.Code())
217
218         if result.Code() != http.StatusCreated {
219                 log.Fatalf("failed to publish the service with HTTP result code %d", result.Code())
220                 return
221         }
222
223         var resultService publishapi.ServiceAPIDescription
224         err = result.UnmarshalJsonToObject(&resultService)
225         assert.NoError(t, err, "error unmarshaling response")
226         assert.Equal(t, newApiId, *resultService.ApiId)
227
228         assert.Equal(t, "http://example.com/published-apis/v1/"+apfId+"/service-apis/"+*resultService.ApiId, result.Recorder.Header().Get(echo.HeaderLocation))
229
230         // Check that the service is published for the provider
231         result = testutil.NewRequest().Get("/published-apis/v1/"+apfId+"/service-apis/"+newApiId).Go(t, requestHandler)
232         assert.Equal(t, http.StatusOK, result.Code())
233
234         err = result.UnmarshalJsonToObject(&resultService)
235         assert.NoError(t, err, "error unmarshaling response")
236         assert.Equal(t, newApiId, *resultService.ApiId)
237
238         aefProfile := (*resultService.AefProfiles)[0]
239         interfaceDescription := (*aefProfile.InterfaceDescriptions)[0]
240
241         resultServiceIpv4 := *interfaceDescription.Ipv4Addr
242         resultServicePort := *interfaceDescription.Port
243
244         kongIPv4 := common29122.Ipv4Addr(myEnv["KONG_IPV4"])
245         kongDataPlanePort := common29122.Port(myPorts["KONG_DATA_PLANE_PORT"])
246
247         assert.NotEmpty(t, kongIPv4, "KONG_IPV4 is required in .env file for unit testing")
248         assert.NotZero(t, kongDataPlanePort, "KONG_DATA_PLANE_PORT is required in .env file for unit testing")
249
250         assert.Equal(t, kongIPv4, resultServiceIpv4)
251         assert.Equal(t, kongDataPlanePort, resultServicePort)
252 }
253
254 func TestOnboardInvoker(t *testing.T) {
255         invokerInfo := "invoker a"
256         newInvoker := getInvoker(invokerInfo)
257
258         // Onboard a valid invoker
259         result := testutil.NewRequest().Post("/api-invoker-management/v1/onboardedInvokers").WithJsonBody(newInvoker).Go(t, requestHandler)
260         assert.Equal(t, http.StatusCreated, result.Code())
261
262         var resultInvoker invokermanagementapi.APIInvokerEnrolmentDetails
263
264         err := result.UnmarshalBodyToObject(&resultInvoker)
265         assert.NoError(t, err, "error unmarshaling response")
266
267         wantedInvokerId := "api_invoker_id_" + strings.Replace(invokerInfo, " ", "_", 1)
268
269         assert.Equal(t, wantedInvokerId, *resultInvoker.ApiInvokerId)
270         assert.Equal(t, newInvoker.NotificationDestination, resultInvoker.NotificationDestination)
271         assert.Equal(t, newInvoker.OnboardingInformation.ApiInvokerPublicKey, resultInvoker.OnboardingInformation.ApiInvokerPublicKey)
272
273         assert.Equal(t, "http://example.com/api-invoker-management/v1/onboardedInvokers/"+*resultInvoker.ApiInvokerId, result.Recorder.Header().Get(echo.HeaderLocation))
274
275         // Onboarding the same invoker should result in Forbidden
276         result = testutil.NewRequest().Post("/api-invoker-management/v1/onboardedInvokers").WithJsonBody(newInvoker).Go(t, requestHandler)
277
278         assert.Equal(t, http.StatusForbidden, result.Code())
279
280         var problemDetails common29122.ProblemDetails
281         err = result.UnmarshalBodyToObject(&problemDetails)
282         assert.NoError(t, err, "error unmarshaling response")
283
284         assert.Equal(t, http.StatusForbidden, *problemDetails.Status)
285         assert.Contains(t, *problemDetails.Cause, "already onboarded")
286
287         // Onboard an invoker missing required NotificationDestination, should get 400 with problem details
288         invalidInvoker := invokermanagementapi.APIInvokerEnrolmentDetails{
289                 OnboardingInformation: invokermanagementapi.OnboardingInformation{
290                         ApiInvokerPublicKey: "newKey",
291                 },
292         }
293         result = testutil.NewRequest().Post("/api-invoker-management/v1/onboardedInvokers").WithJsonBody(invalidInvoker).Go(t, requestHandler)
294         assert.Equal(t, http.StatusBadRequest, result.Code())
295
296         err = result.UnmarshalBodyToObject(&problemDetails)
297         assert.NoError(t, err, "error unmarshaling response")
298
299         assert.Equal(t, http.StatusBadRequest, *problemDetails.Status)
300         assert.Contains(t, *problemDetails.Cause, "missing")
301         assert.Contains(t, *problemDetails.Cause, "NotificationDestination")
302
303         // Onboard an invoker missing required OnboardingInformation.ApiInvokerPublicKey, should get 400 with problem details
304         invalidInvoker = invokermanagementapi.APIInvokerEnrolmentDetails{
305                 NotificationDestination: "http://golang.cafe/",
306         }
307
308         result = testutil.NewRequest().Post("/api-invoker-management/v1/onboardedInvokers").WithJsonBody(invalidInvoker).Go(t, requestHandler)
309         assert.Equal(t, http.StatusBadRequest, result.Code())
310
311         err = result.UnmarshalBodyToObject(&problemDetails)
312         assert.NoError(t, err, "error unmarshaling response")
313
314         assert.Equal(t, http.StatusBadRequest, *problemDetails.Status)
315         assert.Contains(t, *problemDetails.Cause, "missing")
316         assert.Contains(t, *problemDetails.Cause, "OnboardingInformation.ApiInvokerPublicKey")
317 }
318
319 func TestDeleteInvoker(t *testing.T) {
320         invokerInfo := "invoker a"
321         invokerId := "api_invoker_id_" + strings.Replace(invokerInfo, " ", "_", 1)
322
323         // Delete the invoker
324         result := testutil.NewRequest().Delete("/api-invoker-management/v1/onboardedInvokers/"+invokerId).Go(t, requestHandler)
325         assert.Equal(t, http.StatusNoContent, result.Code())
326 }
327
328 func TestUpdateInvoker(t *testing.T) {
329         invokerInfo := "invoker a"
330         invoker := getInvoker(invokerInfo)
331         invokerId := "api_invoker_id_" + strings.Replace(invokerInfo, " ", "_", 1)
332
333         // Onboard a valid invoker
334         result := testutil.NewRequest().Post("/api-invoker-management/v1/onboardedInvokers").WithJsonBody(invoker).Go(t, requestHandler)
335         assert.Equal(t, http.StatusCreated, result.Code())
336
337         // Update the invoker with valid invoker, should return 200 with updated invoker details
338         newNotifURL := "http://golang.org/"
339         invoker.NotificationDestination = common29122.Uri(newNotifURL)
340         newPublicKey := "newPublicKey"
341         invoker.OnboardingInformation.ApiInvokerPublicKey = newPublicKey
342
343         invoker.ApiInvokerId = &invokerId
344
345         result = testutil.NewRequest().Put("/api-invoker-management/v1/onboardedInvokers/"+invokerId).WithJsonBody(invoker).Go(t, requestHandler)
346         assert.Equal(t, http.StatusOK, result.Code())
347
348         var resultInvoker invokermanagementapi.APIInvokerEnrolmentDetails
349
350         err := result.UnmarshalBodyToObject(&resultInvoker)
351         assert.NoError(t, err, "error unmarshaling response")
352
353         assert.Equal(t, invokerId, *resultInvoker.ApiInvokerId)
354         assert.Equal(t, newNotifURL, string(resultInvoker.NotificationDestination))
355         assert.Equal(t, newPublicKey, resultInvoker.OnboardingInformation.ApiInvokerPublicKey)
356
357         // Update with an invoker missing required NotificationDestination, should get 400 with problem details
358         validOnboardingInfo := invokermanagementapi.OnboardingInformation{
359                 ApiInvokerPublicKey: "key",
360         }
361         invalidInvoker := invokermanagementapi.APIInvokerEnrolmentDetails{
362                 ApiInvokerId:          &invokerId,
363                 OnboardingInformation: validOnboardingInfo,
364         }
365         result = testutil.NewRequest().Put("/api-invoker-management/v1/onboardedInvokers/"+invokerId).WithJsonBody(invalidInvoker).Go(t, requestHandler)
366         assert.Equal(t, http.StatusBadRequest, result.Code())
367
368         var problemDetails common29122.ProblemDetails
369         err = result.UnmarshalBodyToObject(&problemDetails)
370         assert.NoError(t, err, "error unmarshaling response")
371
372         assert.Equal(t, http.StatusBadRequest, *problemDetails.Status)
373         assert.Contains(t, *problemDetails.Cause, "missing")
374         assert.Contains(t, *problemDetails.Cause, "NotificationDestination")
375
376         // Update with an invoker missing required OnboardingInformation.ApiInvokerPublicKey, should get 400 with problem details
377         invalidInvoker.NotificationDestination = "http://golang.org/"
378         invalidInvoker.OnboardingInformation = invokermanagementapi.OnboardingInformation{}
379         result = testutil.NewRequest().Put("/api-invoker-management/v1/onboardedInvokers/"+invokerId).WithJsonBody(invalidInvoker).Go(t, requestHandler)
380         assert.Equal(t, http.StatusBadRequest, result.Code())
381
382         err = result.UnmarshalBodyToObject(&problemDetails)
383         assert.NoError(t, err, "error unmarshaling response")
384
385         assert.Equal(t, http.StatusBadRequest, *problemDetails.Status)
386         assert.Contains(t, *problemDetails.Cause, "missing")
387         assert.Contains(t, *problemDetails.Cause, "OnboardingInformation.ApiInvokerPublicKey")
388
389         // Update with an invoker with other ApiInvokerId than the one provided in the URL, should get 400 with problem details
390         invalidId := "1"
391         invalidInvoker.ApiInvokerId = &invalidId
392         invalidInvoker.OnboardingInformation = validOnboardingInfo
393         result = testutil.NewRequest().Put("/api-invoker-management/v1/onboardedInvokers/"+invokerId).WithJsonBody(invalidInvoker).Go(t, requestHandler)
394
395         assert.Equal(t, http.StatusBadRequest, result.Code())
396
397         err = result.UnmarshalBodyToObject(&problemDetails)
398         assert.NoError(t, err, "error unmarshaling response")
399
400         assert.Equal(t, http.StatusBadRequest, *problemDetails.Status)
401         assert.Contains(t, *problemDetails.Cause, "APIInvokerEnrolmentDetails ApiInvokerId doesn't match path parameter")
402
403         // Update an invoker that has not been onboarded, should get 404 with problem details
404         missingId := "1"
405         invoker.ApiInvokerId = &missingId
406         result = testutil.NewRequest().Put("/api-invoker-management/v1/onboardedInvokers/"+missingId).WithJsonBody(invoker).Go(t, requestHandler)
407         assert.Equal(t, http.StatusNotFound, result.Code())
408
409         err = result.UnmarshalBodyToObject(&problemDetails)
410         assert.NoError(t, err, "error unmarshaling response")
411
412         assert.Equal(t, http.StatusNotFound, *problemDetails.Status)
413         assert.Contains(t, *problemDetails.Cause, "not been onboarded")
414         assert.Contains(t, *problemDetails.Cause, "invoker")
415         teardown()
416 }
417
418 func getEcho(myEnv map[string]string, myPorts map[string]int) (*echo.Echo, error) {
419         capifProtocol := myEnv["CAPIF_PROTOCOL"]
420         capifIPv4 := common29122.Ipv4Addr(myEnv["CAPIF_IPV4"])
421         capifPort := common29122.Port(myPorts["CAPIF_PORT"])
422         kongDomain := myEnv["KONG_DOMAIN"]
423         kongProtocol := myEnv["KONG_PROTOCOL"]
424         kongIPv4 := common29122.Ipv4Addr(myEnv["KONG_IPV4"])
425         kongDataPlanePort := common29122.Port(myPorts["KONG_DATA_PLANE_PORT"])
426         kongControlPlanePort := common29122.Port(myPorts["KONG_CONTROL_PLANE_PORT"])
427
428         e := echo.New()
429
430         // Register ProviderManagement
431         providerManagerSwagger, err := provapi.GetSwagger()
432         if err != nil {
433                 log.Fatalf("error loading ProviderManagement swagger spec\n: %s", err)
434                 return nil, err
435         }
436         providerManagerSwagger.Servers = nil
437         providerManager := providermanagement.NewProviderManager(capifProtocol, capifIPv4, capifPort)
438
439         var group *echo.Group
440
441         group = e.Group("/api-provider-management/v1")
442         group.Use(middleware.OapiRequestValidator(providerManagerSwagger))
443         provapi.RegisterHandlersWithBaseURL(e, providerManager, "/api-provider-management/v1")
444
445         publishServiceSwagger, err := publishapi.GetSwagger()
446         if err != nil {
447                 fmt.Fprintf(os.Stderr, "Error loading PublishService swagger spec\n: %s", err)
448                 return nil, err
449         }
450
451         publishServiceSwagger.Servers = nil
452
453         ps := publishservice.NewPublishService(kongDomain, kongProtocol, kongIPv4, kongDataPlanePort, kongControlPlanePort, capifProtocol, capifIPv4, capifPort)
454
455         group = e.Group("/published-apis/v1")
456         group.Use(echomiddleware.Logger())
457         group.Use(middleware.OapiRequestValidator(publishServiceSwagger))
458         publishapi.RegisterHandlersWithBaseURL(e, ps, "/published-apis/v1")
459
460         invokerServiceSwagger, err := invokermanagementapi.GetSwagger()
461         if err != nil {
462                 fmt.Fprintf(os.Stderr, "Error loading InvokerManagement swagger spec\n: %s", err)
463                 return nil, err
464         }
465
466         invokerServiceSwagger.Servers = nil
467
468         im := NewInvokerManager(capifProtocol, capifIPv4, capifPort)
469
470         group = e.Group("/api-invoker-management/v1")
471         group.Use(echomiddleware.Logger())
472         group.Use(middleware.OapiRequestValidator(invokerServiceSwagger))
473         invokermanagementapi.RegisterHandlersWithBaseURL(e, im, "api-invoker-management/v1")
474
475         return e, err
476 }
477
478 func getServiceAPIDescription(aefId, apiName, description string, testServiceIpv4 common29122.Ipv4Addr, testServicePort common29122.Port) publishapi.ServiceAPIDescription {
479         domainName := "Kong"
480         var protocol publishapi.Protocol = "HTTP_1_1"
481
482         return publishapi.ServiceAPIDescription{
483                 AefProfiles: &[]publishapi.AefProfile{
484                         {
485                                 AefId: aefId,
486                                 InterfaceDescriptions: &[]publishapi.InterfaceDescription{
487                                         {
488                                                 Ipv4Addr: &testServiceIpv4,
489                                                 Port:     &testServicePort,
490                                                 SecurityMethods: &[]publishapi.SecurityMethod{
491                                                         "PKI",
492                                                 },
493                                         },
494                                 },
495                                 DomainName: &domainName,
496                                 Protocol:   &protocol,
497                                 Versions: []publishapi.Version{
498                                         {
499                                                 ApiVersion: "v1",
500                                                 Resources: &[]publishapi.Resource{
501                                                         {
502                                                                 CommType: "REQUEST_RESPONSE",
503                                                                 Operations: &[]publishapi.Operation{
504                                                                         "GET",
505                                                                 },
506                                                                 ResourceName: "helloworld",
507                                                                 Uri:          "/helloworld",
508                                                         },
509                                                 },
510                                         },
511                                 },
512                         },
513                 },
514                 ApiName:     apiName,
515                 Description: &description,
516         }
517 }
518
519 func getInvoker(invokerInfo string) invokermanagementapi.APIInvokerEnrolmentDetails {
520         newInvoker := invokermanagementapi.APIInvokerEnrolmentDetails{
521                 ApiInvokerInformation:   &invokerInfo,
522                 NotificationDestination: "http://golang.cafe/",
523                 OnboardingInformation: invokermanagementapi.OnboardingInformation{
524                         ApiInvokerPublicKey: "key",
525                 },
526                 ApiList: nil,
527         }
528         return newInvoker
529 }