X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=capifcore%2Finternal%2Finvokermanagement%2Finvokermanagement.go;h=69d7149144f8a5e36c642dbb9e7d8ef6b7b40227;hb=0b4c4ecb52b1c04037a65644dc8c6c29981d9736;hp=7f5782efffba4978bd30f77a7343c5a758edfdcd;hpb=b4da1f981ba6717f5ec52e15ad1db257b5d6b7f3;p=nonrtric%2Fplt%2Fsme.git diff --git a/capifcore/internal/invokermanagement/invokermanagement.go b/capifcore/internal/invokermanagement/invokermanagement.go index 7f5782e..69d7149 100644 --- a/capifcore/internal/invokermanagement/invokermanagement.go +++ b/capifcore/internal/invokermanagement/invokermanagement.go @@ -39,8 +39,14 @@ import ( //go:generate mockery --name InvokerRegister type InvokerRegister interface { + // Checks if the invoker is registered. + // Returns true of the provided invoker is registered, false otherwise. IsInvokerRegistered(invokerId string) bool + // Verifies that the provided secret is the invoker's registered secret. + // Returns true if the provided secret is the registered invoker's secret, false otherwise. VerifyInvokerSecret(invokerId, secret string) bool + // Gets the provided invoker's registered APIs. + // Returns a list of all the invoker's registered APIs. GetInvokerApiList(invokerId string) *invokerapi.APIList } @@ -51,6 +57,7 @@ type InvokerManager struct { lock sync.Mutex } +// Creates a manager that implements both the InvokerRegister and the invokermanagementapi.ServerInterface interfaces. func NewInvokerManager(publishRegister publishservice.PublishRegister) *InvokerManager { return &InvokerManager{ onboardedInvokers: make(map[string]invokerapi.APIInvokerEnrolmentDetails), @@ -86,6 +93,7 @@ func (im *InvokerManager) GetInvokerApiList(invokerId string) *invokerapi.APILis return nil } +// Creates a new individual API Invoker profile. func (im *InvokerManager) PostOnboardedInvokers(ctx echo.Context) error { var newInvoker invokerapi.APIInvokerEnrolmentDetails err := ctx.Bind(&newInvoker) @@ -110,6 +118,9 @@ func (im *InvokerManager) PostOnboardedInvokers(ctx echo.Context) error { } newInvoker.OnboardingInformation.OnboardingSecret = &onboardingSecret + var apiList invokerapi.APIList = im.publishRegister.GetAllPublishedServices() + newInvoker.ApiList = &apiList + im.onboardedInvokers[*newInvoker.ApiInvokerId] = newInvoker uri := ctx.Request().Host + ctx.Request().URL.String() @@ -123,6 +134,7 @@ func (im *InvokerManager) PostOnboardedInvokers(ctx echo.Context) error { return nil } +// Deletes an individual API Invoker. func (im *InvokerManager) DeleteOnboardedInvokersOnboardingId(ctx echo.Context, onboardingId string) error { im.lock.Lock() defer im.lock.Unlock() @@ -132,6 +144,7 @@ func (im *InvokerManager) DeleteOnboardedInvokersOnboardingId(ctx echo.Context, return ctx.NoContent(http.StatusNoContent) } +// Updates an individual API invoker details. func (im *InvokerManager) PutOnboardedInvokersOnboardingId(ctx echo.Context, onboardingId string) error { var invoker invokerapi.APIInvokerEnrolmentDetails err := ctx.Bind(&invoker)