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.base.PfReferenceKey;
28 import org.onap.policy.models.tosca.concepts.ToscaServiceTemplate;
31 * This interface describes the operations that are provided to users and components for reading
32 * objects from and writing objects to the database.
34 * @author Liam Fallon (liam.fallon@est.tech)
36 public interface PolicyModelsProvider {
41 * @param policyTypeKey the policy type key for the policy types to be retrieved. A null key
42 * name returns all policy types. A null key version returns all versions of the policy
43 * type name specified in the key.
44 * @return the policy types found
45 * @throws PfModelException on errors getting policy types
47 public ToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
50 * Create policy types.
52 * @param serviceTemplate the service template containing the definition of the policy types to
54 * @return the TOSCA service template containing the created policy types
55 * @throws PfModelException on errors creating policy types
57 public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
58 throws PfModelException;
61 * Create policy types.
63 * @param serviceTemplate the service template containing the definition of the policy types to
65 * @return the TOSCA service template containing the modified policy types
66 * @throws PfModelException on errors updating policy types
68 public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
69 throws PfModelException;
72 * Delete policy types.
74 * @param policyTypeKey the policy type key for the policy types to be deleted, if the version
75 * of the key is null, all versions of the policy type are deleted.
76 * @return the TOSCA service template containing the policy types that were deleted
77 * @throws PfModelException on errors deleting policy types
79 public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
84 * @param policyKey the policy key for the policies to be retrieved. The parent name and version
85 * must be specified. A null local name returns all policies for a parent policy type.
86 * @return the policies found
87 * @throws PfModelException on errors getting policies
89 public ToscaServiceTemplate getPolicies(@NonNull final PfReferenceKey policyKey) throws PfModelException;
94 * @param serviceTemplate the service template containing the definitions of the new policies to
96 * @return the TOSCA service template containing the policy types that were created
97 * @throws PfModelException on errors creating policies
99 public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
100 throws PfModelException;
106 * @param serviceTemplate the service template containing the definitions of the policies to be
108 * @return the TOSCA service template containing the policies that were updated
109 * @throws PfModelException on errors updating policies
111 public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
112 throws PfModelException;
117 * @param policyKey the policy key
118 * @return the TOSCA service template containing the policy types that were deleted
119 * @throws PfModelException on errors deleting policies
121 public ToscaServiceTemplate deletePolicies(@NonNull final PfReferenceKey policyKey) throws PfModelException;
126 * @param somePdpGroupFilter a filter for the get
127 * @return the PDP groups found
128 * @throws PfModelException on errors getting PDP groups
130 public Object getPdpGroups(@NonNull final Object somePdpGroupFilter) throws PfModelException;
133 * Creates PDP groups.
135 * @param somePdpGroupSpecification a specification for the PDP group
136 * @throws PfModelException on errors creating PDP groups
138 public Object createPdpGroups(@NonNull final Object somePdpGroupSpecification) throws PfModelException;
142 * Updates PDP groups.
144 * @param somePdpGroupSpecification a specification for the PDP group
145 * @throws PfModelException on errors updating PDP groups
147 public Object updatePdpGroups(@NonNull final Object somePdpGroupSpecification) throws PfModelException;
152 * @param somePdpGroupFilter a filter for the get
153 * @throws PfModelException on errors deleting PDP groups
155 public void deletePdpGroups(@NonNull final Object somePdpGroupFilter) throws PfModelException;