diff --git a/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go b/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go index 183c7b06b7ac3ac70346f8cdc80579708b6df537..41ce53db802a998de5a3400f902ce7d49e705f6f 100644 --- a/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go +++ b/go-apps/meep-app-enablement/server/capif-mgmt/service-mgmt.go @@ -717,9 +717,53 @@ func appServicesByIdPATCH(w http.ResponseWriter, r *http.Request) { } // else, nothing to do _sInfo.LivenessInterval = sInfoPrev.LivenessInterval - // Send response + // Map ServiceInfoList to ServiceApiDescription list + serviceApiDescriptions := make([]ServiceApiDescription, 0) + + // Assuming _sInfo is an instance of ServiceInfo + service := _sInfo + + // Create an AefProfile from TransportInfo inside ServiceInfo + aefProfile := AefProfile{ + AefId: service.TransportInfo.Id, + Versions: []string{service.Version}, // Assuming Version is a string + InterfaceDescriptions: service.TransportInfo.Endpoint, + VendorSpecificUrnetsimeccapifexttransportInfo: &MecTransportInfoCapifExt{ + Name: service.TransportInfo.Name, + Type_: service.TransportInfo.Type_, + Protocol: service.TransportInfo.Protocol, + Version: service.TransportInfo.Version, + Security: service.TransportInfo.Security, + }, + } + + // Create the ServiceApiDescription and populate it with data from ServiceInfo + apiDesc := ServiceApiDescription{ + ApiName: service.SerName, // Map SerName to ApiName + ApiId: service.SerInstanceId, // Map SerInstanceId to ApiId + AefProfiles: []AefProfile{aefProfile}, + VendorSpecificUrnetsimeccapifextserviceInfo: &MecServiceInfoCapifExt{ + Serializer: service.Serializer, + State: service.State, + ScopeOfLocality: service.ScopeOfLocality, + ConsumedLocalOnly: service.ConsumedLocalOnly, + IsLocal: service.IsLocal, + Category: service.SerCategory, + }, + } + + // Add the created apiDesc to the serviceApiDescriptions slice + serviceApiDescriptions = append(serviceApiDescriptions, apiDesc) + + // Prepare & send response + jsonResponse, err := json.Marshal(serviceApiDescriptions) + if err != nil { + log.Error(err.Error()) + errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) + return + } w.WriteHeader(http.StatusOK) - fmt.Fprint(w, convertServiceInfoToJson_2(dsInfo)) + fmt.Fprint(w, string(jsonResponse)) } func appServicesByIdDELETE(w http.ResponseWriter, r *http.Request) {