Creation of Policy Type Instance
Api for Creation of Policy Type Instance
Signed-off-by: naman.gupta <naman.gupta@samsung.com>
Change-Id: I649dd94059263244645e7a8236ad058c3f0af56f
diff --git a/a1-go/pkg/restful/restful.go b/a1-go/pkg/restful/restful.go
index 26a229f..b494dab 100644
--- a/a1-go/pkg/restful/restful.go
+++ b/a1-go/pkg/restful/restful.go
@@ -68,10 +68,22 @@
})
api.A1MediatorA1ControllerGetPolicyTypeHandler = a1_mediator.A1ControllerGetPolicyTypeHandlerFunc(func(params a1_mediator.A1ControllerGetPolicyTypeParams) middleware.Responder {
- a1.Logger.Error("handler for get policy type from policytypeID")
+ a1.Logger.Debug("handler for get policy type from policytypeID")
return a1_mediator.NewA1ControllerGetPolicyTypeOK().WithPayload(r.rh.GetPolicyType(models.PolicyTypeID(params.PolicyTypeID)))
})
+ api.A1MediatorA1ControllerCreateOrReplacePolicyInstanceHandler = a1_mediator.A1ControllerCreateOrReplacePolicyInstanceHandlerFunc(func(params a1_mediator.A1ControllerCreateOrReplacePolicyInstanceParams) middleware.Responder {
+ a1.Logger.Debug("handler for create policy type instance ")
+ if err = r.rh.CreatePolicyInstance(models.PolicyTypeID(params.PolicyTypeID), models.PolicyInstanceID(params.PolicyInstanceID), params.Body); err == nil {
+ return a1_mediator.NewA1ControllerCreateOrReplacePolicyInstanceAccepted()
+ }
+ if r.rh.IsValidJson(err) {
+ return a1_mediator.NewA1ControllerCreateOrReplacePolicyInstanceBadRequest()
+ }
+ return a1_mediator.NewA1ControllerCreateOrReplacePolicyInstanceServiceUnavailable()
+
+ })
+
return api
}