2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.models.provider;
23 import lombok.NonNull;
25 import org.onap.policy.models.base.PfConceptKey;
26 import org.onap.policy.models.base.PfModelException;
27 import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;
28 import org.onap.policy.models.tosca.serialization.legacy.LegacyGuardPolicy;
29 import org.onap.policy.models.tosca.serialization.legacy.LegacyOperationalPolicy;
32 * This interface describes the operations that are provided to users and components for reading
33 * objects from and writing objects to the database.
35 * @author Liam Fallon (liam.fallon@est.tech)
37 public interface PolicyModelsProvider {
42 * @param policyTypeKey the policy type key for the policy types to be retrieved. A null key
43 * name returns all policy types. A null key version returns all versions of the policy
44 * type name specified in the key.
45 * @return the policy types found
46 * @throws PfModelException on errors getting policy types
48 public ToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
51 * Create policy types.
53 * @param serviceTemplate the service template containing the definition of the policy types to
55 * @return the TOSCA service template containing the created policy types
56 * @throws PfModelException on errors creating policy types
58 public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
59 throws PfModelException;
62 * Create policy types.
64 * @param serviceTemplate the service template containing the definition of the policy types to
66 * @return the TOSCA service template containing the modified policy types
67 * @throws PfModelException on errors updating policy types
69 public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
70 throws PfModelException;
73 * Delete policy types.
75 * @param policyTypeKey the policy type key for the policy types to be deleted, if the version
76 * of the key is null, all versions of the policy type are deleted.
77 * @return the TOSCA service template containing the policy types that were deleted
78 * @throws PfModelException on errors deleting policy types
80 public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
85 * @param policyKey the policy key for the policies to be retrieved. The parent name and version
86 * must be specified. A null local name returns all policies for a parent policy type.
87 * @return the policies found
88 * @throws PfModelException on errors getting policies
90 public ToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException;
95 * @param serviceTemplate the service template containing the definitions of the new policies to
97 * @return the TOSCA service template containing the policy types that were created
98 * @throws PfModelException on errors creating policies
100 public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
101 throws PfModelException;
107 * @param serviceTemplate the service template containing the definitions of the policies to be
109 * @return the TOSCA service template containing the policies that were updated
110 * @throws PfModelException on errors updating policies
112 public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
113 throws PfModelException;
118 * @param policyKey the policy key
119 * @return the TOSCA service template containing the policy types that were deleted
120 * @throws PfModelException on errors deleting policies
122 public ToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException;
125 * Get legacy operational policy.
127 * @param policyId ID of the policy.
128 * @return the policies found
129 * @throws PfModelException on errors getting policies
131 public LegacyOperationalPolicy getOperationalPolicy(@NonNull final String policyId) throws PfModelException;
134 * Create legacy operational policy.
136 * @param legacyOperationalPolicy the definition of the policy to be created.
137 * @return the created policy
138 * @throws PfModelException on errors creating policies
140 public LegacyOperationalPolicy createOperationalPolicy(
141 @NonNull final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException;
144 * Update legacy operational policy.
146 * @param legacyOperationalPolicy the definition of the policy to be updated
147 * @return the updated policy
148 * @throws PfModelException on errors updating policies
150 public LegacyOperationalPolicy updateOperationalPolicy(
151 @NonNull final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException;
154 * Delete legacy operational policy.
156 * @param policyId ID of the policy.
157 * @return the deleted policy
158 * @throws PfModelException on errors deleting policies
160 public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull final String policyId) throws PfModelException;
163 * Get legacy guard policy.
165 * @param policyId ID of the policy.
166 * @return the policies found
167 * @throws PfModelException on errors getting policies
169 public LegacyGuardPolicy getGuardPolicy(@NonNull final String policyId) throws PfModelException;
172 * Create legacy guard policy.
174 * @param legacyGuardPolicy the definition of the policy to be created.
175 * @return the created policy
176 * @throws PfModelException on errors creating policies
178 public LegacyGuardPolicy createGuardPolicy(@NonNull final LegacyGuardPolicy legacyGuardPolicy)
179 throws PfModelException;
182 * Update legacy guard policy.
184 * @param legacyGuardPolicy the definition of the policy to be updated
185 * @return the updated policy
186 * @throws PfModelException on errors updating policies
188 public LegacyGuardPolicy updateGuardPolicy(@NonNull final LegacyGuardPolicy legacyGuardPolicy)
189 throws PfModelException;
192 * Delete legacy guard policy.
194 * @param policyId ID of the policy.
195 * @return the deleted policy
196 * @throws PfModelException on errors deleting policies
198 public LegacyGuardPolicy deleteGuardPolicy(@NonNull final String policyId) throws PfModelException;
203 * @param somePdpGroupFilter a filter for the get
204 * @return the PDP groups found
205 * @throws PfModelException on errors getting PDP groups
207 public Object getPdpGroups(@NonNull final Object somePdpGroupFilter) throws PfModelException;
210 * Creates PDP groups.
212 * @param somePdpGroupSpecification a specification for the PDP group
213 * @throws PfModelException on errors creating PDP groups
215 public Object createPdpGroups(@NonNull final Object somePdpGroupSpecification) throws PfModelException;
219 * Updates PDP groups.
221 * @param somePdpGroupSpecification a specification for the PDP group
222 * @throws PfModelException on errors updating PDP groups
224 public Object updatePdpGroups(@NonNull final Object somePdpGroupSpecification) throws PfModelException;
229 * @param somePdpGroupFilter a filter for the get
230 * @throws PfModelException on errors deleting PDP groups
232 public Object deletePdpGroups(@NonNull final Object somePdpGroupFilter) throws PfModelException;