Merge "Remove Notification code for updated events"
[cps.git] / cps-service / src / main / java / org / onap / cps / api / CpsAdminService.java
1 /*
2  *  ============LICENSE_START=======================================================
3  *  Copyright (C) 2020-2023 Nordix Foundation
4  *  Modifications Copyright (C) 2020-2022 Bell Canada.
5  *  Modifications Copyright (C) 2021 Pantheon.tech
6  *  Modifications Copyright (C) 2022 TechMahindra Ltd.
7  *  ================================================================================
8  *  Licensed under the Apache License, Version 2.0 (the "License");
9  *  you may not use this file except in compliance with the License.
10  *  You may obtain a copy of the License at
11  *
12  *        http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *  Unless required by applicable law or agreed to in writing, software
15  *  distributed under the License is distributed on an "AS IS" BASIS,
16  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  *  See the License for the specific language governing permissions and
18  *  limitations under the License.
19  *
20  *  SPDX-License-Identifier: Apache-2.0
21  *  ============LICENSE_END=========================================================
22  */
23
24 package org.onap.cps.api;
25
26 import java.util.Collection;
27 import org.onap.cps.spi.exceptions.AlreadyDefinedException;
28 import org.onap.cps.spi.exceptions.CpsException;
29 import org.onap.cps.spi.model.Anchor;
30 import org.onap.cps.spi.model.Dataspace;
31
32 /**
33  * CPS Admin Service.
34  */
35 public interface CpsAdminService {
36
37     /**
38      * Create dataspace.
39      *
40      * @param dataspaceName dataspace name
41      * @throws AlreadyDefinedException if dataspace with same name already exists
42      */
43     void createDataspace(String dataspaceName);
44
45     /**
46      * Delete dataspace.
47      *
48      * @param dataspaceName the name of the dataspace to delete
49      */
50     void deleteDataspace(String dataspaceName);
51
52     /**
53      * Get dataspace by given dataspace name.
54      *
55      * @param dataspaceName dataspace name
56      * @return a dataspace
57      */
58     Dataspace getDataspace(String dataspaceName);
59
60     /**
61      * Get All Dataspaces.
62      *
63      *
64      * @return a collection of dataspaces
65      */
66     Collection<Dataspace> getAllDataspaces();
67
68     /**
69      * Create an Anchor.
70      *
71      * @param dataspaceName dataspace name
72      * @param schemaSetName schema set name
73      * @param anchorName    anchor name
74      * @throws CpsException if input data is invalid.
75      */
76     void createAnchor(String dataspaceName, String schemaSetName, String anchorName);
77
78     /**
79      * Read all anchors in the given dataspace.
80      *
81      * @param dataspaceName dataspace name
82      * @return a collection of anchors
83      */
84     Collection<Anchor> getAnchors(String dataspaceName);
85
86     /**
87      * Read all anchors associated with the given schema-set in the given dataspace.
88      *
89      * @param dataspaceName dataspace name
90      * @param schemaSetName schema-set name
91      * @return a collection of anchors
92      */
93     Collection<Anchor> getAnchors(String dataspaceName, String schemaSetName);
94
95     /**
96      * Read all anchors associated with the given schema-sets in the given dataspace.
97      *
98      * @param dataspaceName  dataspace name
99      * @param schemaSetNames schema-set names
100      * @return a collection of anchors
101      */
102     Collection<Anchor> getAnchors(String dataspaceName, Collection<String> schemaSetNames);
103
104     /**
105      * Get an anchor in the given dataspace using the anchor name.
106      *
107      * @param dataspaceName dataspace name
108      * @param anchorName    anchor name
109      * @return an anchor
110      */
111     Anchor getAnchor(String dataspaceName, String anchorName);
112
113     /**
114      * Delete anchor by name in given dataspace.
115      *
116      * @param dataspaceName dataspace name
117      * @param anchorName    anchor name
118      */
119     void deleteAnchor(String dataspaceName, String anchorName);
120
121     /**
122      * Delete anchors by name in given dataspace.
123      *
124      * @param dataspaceName dataspace name
125      * @param anchorNames   anchor names
126      */
127     void deleteAnchors(String dataspaceName, Collection<String> anchorNames);
128
129     /**
130      * Query anchor names for the given module names in the provided dataspace.
131      *
132      * @param dataspaceName dataspace name
133      * @param moduleNames   a collection of module names
134      * @return a collection of anchor names in the given dataspace. The schema set for each anchor must include all the
135      *         given module names
136      */
137     Collection<String> queryAnchorNames(String dataspaceName, Collection<String> moduleNames);
138
139     /**
140      * Update schema set of an anchor.
141      *
142      * @param dataspaceName dataspace name
143      * @param anchorName    anchor name
144      * @param schemaSetName schema set name
145      */
146     void updateAnchorSchemaSet(String dataspaceName, String anchorName, String schemaSetName);
147 }