/*
==================================================================================
- Copyright (c) 2021 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) 2021 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
+
+ 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).
- This source code is part of the near-RT RIC (RAN Intelligent Controller)
- platform project (RICP).
==================================================================================
*/
package restful
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 {
+ var notificationDestination string
+ if params.NotificationDestination != nil {
+ notificationDestination = *params.NotificationDestination
+ }
+ if err = r.rh.CreatePolicyInstance(models.PolicyTypeID(params.PolicyTypeID), models.PolicyInstanceID(params.PolicyInstanceID), params.Body, notificationDestination); err == nil {
+
return a1_mediator.NewA1ControllerCreateOrReplacePolicyInstanceAccepted()
}
if r.rh.IsValidJson(err) {
a1.Logger.Debug("handler for get policy instance status")
if resp, err := r.rh.GetPolicyInstanceStatus(models.PolicyTypeID(params.PolicyTypeID), models.PolicyInstanceID(params.PolicyInstanceID)); err == nil {
return a1_mediator.NewA1ControllerGetPolicyInstanceStatusOK().WithPayload(resp)
- }
- if r.rh.IsPolicyInstanceNotFound(err) {
+ } else if r.rh.IsPolicyInstanceNotFound(err) {
return a1_mediator.NewA1ControllerGetPolicyInstanceStatusNotFound()
}
return a1_mediator.NewA1ControllerGetPolicyInstanceStatusServiceUnavailable()