Delete Policy Instance API feature.
Implementation of Deletion of Policy Instance API
Signed-off-by: naman.gupta <naman.gupta@samsung.com>
Change-Id: Id20356cd9fa8d9138d965e96d23de4e76b8c98be
diff --git a/a1-go/pkg/restful/restful.go b/a1-go/pkg/restful/restful.go
index 17d1fad..b0663dd 100644
--- a/a1-go/pkg/restful/restful.go
+++ b/a1-go/pkg/restful/restful.go
@@ -133,6 +133,19 @@
return a1_mediator.NewA1ControllerGetPolicyInstanceStatusServiceUnavailable()
})
+ api.A1MediatorA1ControllerDeletePolicyInstanceHandler = a1_mediator.A1ControllerDeletePolicyInstanceHandlerFunc(func(params a1_mediator.A1ControllerDeletePolicyInstanceParams) middleware.Responder {
+ a1.Logger.Debug("handler for delete policy instance")
+ if err := r.rh.DeletePolicyInstance(models.PolicyTypeID(params.PolicyTypeID), models.PolicyInstanceID(params.PolicyInstanceID)); err != nil {
+ if r.rh.CanPolicyInstanceBeDeleted(err) {
+ return a1_mediator.NewA1ControllerDeletePolicyInstanceNotFound()
+ }
+ return a1_mediator.NewA1ControllerDeletePolicyInstanceServiceUnavailable()
+ }
+
+ return a1_mediator.NewA1ControllerDeletePolicyInstanceAccepted()
+
+ })
+
return api
}