0144f8c68d6bb832235e7b49eb317b375f7fee5f
[policy/models.git] / models-provider / src / main / java / org / onap / policy / models / provider / PolicyModelsProvider.java
1 /*-
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
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.models.provider;
22
23 import lombok.NonNull;
24
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;
29
30 /**
31  * This interface describes the operations that are provided to users and components for reading
32  * objects from and writing objects to the database.
33  *
34  * @author Liam Fallon (liam.fallon@est.tech)
35  */
36 public interface PolicyModelsProvider {
37
38     /**
39      * Get policy types.
40      *
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
46      */
47     public ToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
48
49     /**
50      * Create policy types.
51      *
52      * @param serviceTemplate the service template containing the definition of the policy types to
53      *        be created
54      * @return the TOSCA service template containing the created policy types
55      * @throws PfModelException on errors creating policy types
56      */
57     public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
58             throws PfModelException;
59
60     /**
61      * Create policy types.
62      *
63      * @param serviceTemplate the service template containing the definition of the policy types to
64      *        be modified
65      * @return the TOSCA service template containing the modified policy types
66      * @throws PfModelException on errors updating policy types
67      */
68     public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
69             throws PfModelException;
70
71     /**
72      * Delete policy types.
73      *
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
78      */
79     public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
80
81     /**
82      * Get policies.
83      *
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
88      */
89     public ToscaServiceTemplate getPolicies(@NonNull final PfReferenceKey policyKey) throws PfModelException;
90
91     /**
92      * Create policies.
93      *
94      * @param serviceTemplate the service template containing the definitions of the new policies to
95      *        be created.
96      * @return the TOSCA service template containing the policy types that were created
97      * @throws PfModelException on errors creating policies
98      */
99     public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
100             throws PfModelException;
101
102
103     /**
104      * Update policies.
105      *
106      * @param serviceTemplate the service template containing the definitions of the policies to be
107      *        updated.
108      * @return the TOSCA service template containing the policies that were updated
109      * @throws PfModelException on errors updating policies
110      */
111     public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
112             throws PfModelException;
113
114     /**
115      * Delete policies.
116      *
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
120      */
121     public ToscaServiceTemplate deletePolicies(@NonNull final PfReferenceKey policyKey) throws PfModelException;
122
123     /**
124      * Get PDP groups.
125      *
126      * @param somePdpGroupFilter a filter for the get
127      * @return the PDP groups found
128      * @throws PfModelException on errors getting PDP groups
129      */
130     public Object getPdpGroups(@NonNull final Object somePdpGroupFilter) throws PfModelException;
131
132     /**
133      * Creates PDP groups.
134      *
135      * @param somePdpGroupSpecification a specification for the PDP group
136      * @throws PfModelException on errors creating PDP groups
137      */
138     public Object createPdpGroups(@NonNull final Object somePdpGroupSpecification) throws PfModelException;
139
140
141     /**
142      * Updates PDP groups.
143      *
144      * @param somePdpGroupSpecification a specification for the PDP group
145      * @throws PfModelException on errors updating PDP groups
146      */
147     public Object updatePdpGroups(@NonNull final Object somePdpGroupSpecification) throws PfModelException;
148
149     /**
150      * Delete PDP groups.
151      *
152      * @param somePdpGroupFilter a filter for the get
153      * @throws PfModelException on errors deleting PDP groups
154      */
155     public void deletePdpGroups(@NonNull final Object somePdpGroupFilter) throws PfModelException;
156 }