diff options
author | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2021-08-19 15:34:00 -0400 |
---|---|---|
committer | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2021-08-19 16:17:34 -0400 |
commit | 784b94f5872721fadf39cc459e02bd77d9e7c796 (patch) | |
tree | dab579e861e2484bd5cc5d09438f2f3b24c7b164 /plugins/forwarding-plugins/src/main | |
parent | 801ab43d13537d19710e8f948d4614f158daafc7 (diff) |
Use generic create policy api
Change lifecycycle api forwarder to use
generic create policy api for creating policies.
Hence, no need to parse the tosca template and
find fields to build the specific url.
Issue-ID: POLICY-3545
Change-Id: I848df3cf2e0cbb9136120769293cc466d660036a
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
Diffstat (limited to 'plugins/forwarding-plugins/src/main')
-rw-r--r-- | plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java index 8640332d..7f9d690d 100644 --- a/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java +++ b/plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java @@ -54,7 +54,8 @@ import org.slf4j.LoggerFactory; public class LifecycleApiPolicyForwarder implements PolicyForwarder { private static final String DEPLOY_POLICY_URI = "/policy/pap/v1/pdps/policies"; - private static final String CREATE_POLICY_TYPE_URI = "/policy/api/v1/policytypes/"; + private static final String CREATE_POLICY_TYPE_URI = "/policy/api/v1/policytypes"; + private static final String CREATE_POLICY_URI = "/policy/api/v1/policies"; private static final Logger LOGGER = LoggerFactory.getLogger(LifecycleApiPolicyForwarder.class); private LifecycleApiForwarderParameters forwarderParameters; @@ -120,10 +121,8 @@ public class LifecycleApiPolicyForwarder implements PolicyForwarder { } private Response createPolicy(final ToscaServiceTemplate toscaServiceTemplate) throws PolicyForwardingException { - final ToscaPolicy policy = toscaServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).entrySet() - .iterator().next().getValue(); return invokeHttpClient(Entity.entity(toscaServiceTemplate, MediaType.APPLICATION_JSON), - CREATE_POLICY_TYPE_URI + policy.getType() + "/versions/" + policy.getTypeVersion() + "/policies", true); + CREATE_POLICY_URI, true); } private Response deployPolicy(final ToscaServiceTemplate toscaServiceTemplate) throws PolicyForwardingException { |