-//==================================================================================
-// Copyright (c) 2022 Samsung
+// ==================================================================================
//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
+// Copyright (c) 2022 Samsung
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+// http://www.apache.org/licenses/LICENSE-2.0
//
-// This source code is part of the near-RT RIC (RAN Intelligent Controller)
-// platform project (RICP).
-//==================================================================================
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
//
+// This source code is part of the near-RT RIC (RAN Intelligent Controller)
+// platform project (RICP).
+//
+// ==================================================================================
package restful
import (
ch "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/charts"
dm "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/deploy"
ph "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/health"
+ "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/models"
po "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/onboard"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations/charts"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations/deploy"
+ "gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations/experiment"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations/health"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/restapi/operations/onboard"
"gerrit.o-ran-sc.org/r/ric-plt/ricdms/pkg/resthooks"
return resp
})
+ api.HealthGetHealthcheckXAppXAppNameNamespaceNamespaceHandler = health.GetHealthcheckXAppXAppNameNamespaceNamespaceHandlerFunc(func(param health.GetHealthcheckXAppXAppNameNamespaceNamespaceParams) middleware.Responder {
+ ricdms.Logger.Debug("==> Healthcheck for xApp is invoked")
+ resp := r.rh.GetxAppHealth(param.XAppName, param.Namespace)
+ return resp
+ })
+
api.OnboardPostOnboardxAppsHandler = onboard.PostOnboardxAppsHandlerFunc(func(poap onboard.PostOnboardxAppsParams) middleware.Responder {
ricdms.Logger.Debug("==> onboard API invoked.")
resp := r.rh.OnBoard(poap.Body)
return resp
})
+ api.DeployDeleteDeployHandler = deploy.DeleteDeployHandlerFunc(func(param deploy.DeleteDeployParams) middleware.Responder {
+ ricdms.Logger.Debug("==> undeploy xApp")
+ resp := r.rh.UninstallChart(*param.Body.XAppname, *param.Body.Version, param.Body.Namespace)
+ return resp
+ })
+
+ api.ExperimentPostCustomOnboardHandler = experiment.PostCustomOnboardHandlerFunc(func(pcop experiment.PostCustomOnboardParams) middleware.Responder {
+ ricdms.Logger.Debug("==> invoked custom onboarding")
+ if pcop.Helmpkg == nil {
+ errString := "formdata not provided with key helmpkg"
+ return experiment.NewPostCustomOnboardInternalServerError().WithPayload(&models.ErrorMessage{
+ ErrorMessage: &errString,
+ })
+ }
+ defer pcop.Helmpkg.Close()
+ return r.rh.Onboarder.CustomOnboard(pcop.Helmpkg)
+ })
+
api.ApplicationZipProducer = runtime.ProducerFunc(func(w io.Writer, data interface{}) error {
if zp, ok := data.(io.ReadCloser); ok {
defer zp.Close()