// ========================LICENSE_START=================================
// O-RAN-SC
// %%
-// Copyright (C) 2022: Nordix Foundation
+// Copyright (C) 2022-2023: Nordix Foundation
+// Copyright (C) 2024: OpenInfra Foundation Europe
// %%
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
return sendCoreError(ctx, http.StatusForbidden, fmt.Sprintf(errMsg, err))
}
- if err = im.validateInvoker(newInvoker, ctx); err != nil {
+ if err = im.validateInvoker(newInvoker); err != nil {
return sendCoreError(ctx, http.StatusBadRequest, fmt.Sprintf(errMsg, err))
}
}
func (im *InvokerManager) prepareNewInvoker(newInvoker *invokerapi.APIInvokerEnrolmentDetails) {
- var apiList invokerapi.APIList = im.publishRegister.GetAllPublishedServices()
- newInvoker.ApiList = &apiList
+ var apiListRequestedServices invokerapi.APIList = nil
+ if newInvoker.ApiList != nil {
+ apiListRequestedServices = *newInvoker.ApiList
+ }
+ var allowedPublishedServices invokerapi.APIList = im.publishRegister.GetAllowedPublishedServices(apiListRequestedServices)
+ newInvoker.ApiList = &allowedPublishedServices
im.lock.Lock()
defer im.lock.Unlock()
newInvoker.PrepareNewInvoker()
-
im.addClientInKeycloak(newInvoker)
-
im.onboardedInvokers[*newInvoker.ApiInvokerId] = *newInvoker
}
return sendCoreError(ctx, http.StatusBadRequest, fmt.Sprintf(errMsg, errMismatch))
}
- if err := im.validateInvoker(newInvoker, ctx); err != nil {
+ if err := im.validateInvoker(newInvoker); err != nil {
return sendCoreError(ctx, http.StatusBadRequest, fmt.Sprintf(errMsg, err))
}
return ctx.NoContent(http.StatusNotImplemented)
}
-func (im *InvokerManager) validateInvoker(invoker invokerapi.APIInvokerEnrolmentDetails, ctx echo.Context) error {
+func (im *InvokerManager) validateInvoker(invoker invokerapi.APIInvokerEnrolmentDetails) error {
if err := invoker.Validate(); err != nil {
return err
}