2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * SPDX-License-Identifier: Apache-2.0
20 * ============LICENSE_END=========================================================
23 package org.onap.policy.api.main.rest.provider;
25 import org.onap.policy.model.tosca.ToscaPolicy;
26 import org.onap.policy.model.tosca.ToscaPolicyList;
29 * Class to provide all kinds of policy operations.
31 public class PolicyProvider {
33 private static final String POST_OK = "Successfully created";
34 private static final String DELETE_OK = "Successfully deleted";
37 * Retrieves a list of policies matching specified ID and version of both policy type and policy.
39 * @param policyTypeId the ID of policy type
40 * @param policyTypeVersion the version of policy type
41 * @param policyId the ID of policy
42 * @param policyVersion the version of policy
44 * @return the ToscaPolicyList object containing a list of policies matching specified fields
46 public ToscaPolicyList fetchPolicies(String policyTypeId, String policyTypeVersion,
47 String policyId, String policyVersion) {
49 return new ToscaPolicyList();
53 * Creates a new policy for a policy type ID and version.
55 * @param policyTypeId the ID of policy type
56 * @param policyTypeVersion the version of policy type
57 * @param body the entity body of policy
59 * @return a string message indicating the operation results
61 public String createPolicy(String policyTypeId, String policyTypeVersion, ToscaPolicy body) {
67 * Deletes the policies matching specified ID and version of both policy type and policy.
69 * @param policyTypeId the ID of policy type
70 * @param policyTypeVersion the version of policy type
71 * @param policyId the ID of policy
72 * @param policyVersion the version of policy
74 * @return a string message indicating the operation results
76 public String deletePolicies(String policyTypeId, String policyTypeVersion,
77 String policyId, String policyVersion) {