Skip to content
Snippets Groups Projects
Commit 011d205f authored by Ikram Haq's avatar Ikram Haq
Browse files

Add api-invoker-id query parameter functionality

parent 6c1168bd
No related branches found
No related tags found
1 merge request!1Merge CAPIF into MEC Federation branch for ETSI SNS4SNS demo
......@@ -616,8 +616,23 @@ func servicesGET(w http.ResponseWriter, r *http.Request) {
mutex.Lock()
defer mutex.Unlock()
// Validate query parameters
u, _ := url.Parse(r.URL.String())
q := u.Query()
validParams := []string{"api-invoker-id"}
err := validateQueryParams(q, validParams)
if err != nil {
errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest)
return
}
getServices(w, r, "")
// Extract and parse query parameters
api_invoker_id := q.Get("api-invoker-id")
if api_invoker_id != "" {
getServices(w, r, api_invoker_id)
} else {
getServices(w, r, "")
}
}
func applicationsSubscriptionsPOST(w http.ResponseWriter, r *http.Request) {
......@@ -1192,7 +1207,7 @@ func getServices(w http.ResponseWriter, r *http.Request, appId string) {
// Validate query parameters
u, _ := url.Parse(r.URL.String())
q := u.Query()
validParams := []string{"vend-spec-etsi-mec-serinstance-id", "api-name", "vend-spec-etsi-mec-sercategory-id", "vend-spec-etsi-mec-consumed-local-only", "vend-spec-etsi-mec-is-local", "vend-spec-etsi-mec-scope-of-locality"}
validParams := []string{"api-invoker-id", "vend-spec-etsi-mec-serinstance-id", "api-name", "vend-spec-etsi-mec-sercategory-id", "vend-spec-etsi-mec-consumed-local-only", "vend-spec-etsi-mec-is-local", "vend-spec-etsi-mec-scope-of-locality"}
err := validateQueryParams(q, validParams)
if err != nil {
errHandlerProblemDetails(w, err.Error(), http.StatusBadRequest)
......@@ -1320,7 +1335,7 @@ func getServices(w http.ResponseWriter, r *http.Request, appId string) {
for _, service := range sInfoList.Services {
aefProfile := AefProfile{
AefId: service.TransportInfo.Id,
Versions: []string{service.Version}, // Assuming service.Version is a string, wrap it in a slice
Versions: []string{service.Version},
InterfaceDescriptions: service.TransportInfo.Endpoint,
VendorSpecificUrnetsimeccapifexttransportInfo: &MecTransportInfoCapifExt{
Name: service.TransportInfo.Name,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment