Uploaded image for project: 'Policy Framework'
  1. Policy Framework
  2. POLICY-1991

Create a new simplified API for creating policies

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Done
    • Icon: Medium Medium
    • Frankfurt Release
    • None
    • None

      As a ONAP developer, I would like to create a simplified REST API for creating policies.

      The current API expects policy type id & policy type version to be part of the URI.

       

       For example: to create policy we have to do this:

       

      private Response createPolicy(final ToscaServiceTemplate toscaServiceTemplate) throws PolicyForwardingException

      {         *final* String policyType = toscaServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).entrySet()                 .iterator().next().getValue().getType();         *final* String policyTypeVersion = toscaServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).entrySet()                 .iterator().next().getValue().getTypeVersion();         *return* invokeHttpClient(Entity._entity_(toscaServiceTemplate, MediaType.*_APPLICATION_JSON_*),                 "/policy/api/v1/policytypes/" + policyType + "/versions/" + policyTypeVersion + "/policies", "API"); }

       

      Whereas the URI should be something simple like “policy/api/v1/policies” with a POST input body.

            cgao cgao
            ramverma ramverma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: