Merge "Remove Notification code for updated events"
[cps.git] / cps-service / src / main / java / org / onap / cps / api / CpsAnchorService.java
1 /*
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2023 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.cps.api;
22
23 import java.util.Collection;
24 import org.onap.cps.spi.exceptions.CpsException;
25 import org.onap.cps.spi.model.Anchor;
26
27 public interface CpsAnchorService {
28
29     /**
30      * Create an Anchor.
31      *
32      * @param dataspaceName dataspace name
33      * @param schemaSetName schema set name
34      * @param anchorName    anchor name
35      * @throws CpsException if input data is invalid.
36      */
37     void createAnchor(String dataspaceName, String schemaSetName, String anchorName);
38
39     /**
40      * Read all anchors in the given dataspace.
41      *
42      * @param dataspaceName dataspace name
43      * @return a collection of anchors
44      */
45     Collection<Anchor> getAnchors(String dataspaceName);
46
47     /**
48      * Read all anchors associated with the given schema-set in the given dataspace.
49      *
50      * @param dataspaceName dataspace name
51      * @param schemaSetName schema-set name
52      * @return a collection of anchors
53      */
54     Collection<Anchor> getAnchors(String dataspaceName, String schemaSetName);
55
56     /**
57      * Read all anchors associated with the given schema-sets in the given dataspace.
58      *
59      * @param dataspaceName  dataspace name
60      * @param schemaSetNames schema-set names
61      * @return a collection of anchors
62      */
63     Collection<Anchor> getAnchors(String dataspaceName, Collection<String> schemaSetNames);
64
65     /**
66      * Get an anchor in the given dataspace using the anchor name.
67      *
68      * @param dataspaceName dataspace name
69      * @param anchorName    anchor name
70      * @return an anchor
71      */
72     Anchor getAnchor(String dataspaceName, String anchorName);
73
74     /**
75      * Delete anchor by name in given dataspace.
76      *
77      * @param dataspaceName dataspace name
78      * @param anchorName    anchor name
79      */
80     void deleteAnchor(String dataspaceName, String anchorName);
81
82     /**
83      * Delete anchors by name in given dataspace.
84      *
85      * @param dataspaceName dataspace name
86      * @param anchorNames   anchor names
87      */
88     void deleteAnchors(String dataspaceName, Collection<String> anchorNames);
89
90     /**
91      * Query anchor names for the given module names in the provided dataspace.
92      *
93      * @param dataspaceName dataspace name
94      * @param moduleNames   a collection of module names
95      * @return a collection of anchor names in the given dataspace. The schema set for each anchor must include all the
96      *         given module names
97      */
98     Collection<String> queryAnchorNames(String dataspaceName, Collection<String> moduleNames);
99
100     /**
101      * Update schema set of an anchor.
102      *
103      * @param dataspaceName dataspace name
104      * @param anchorName    anchor name
105      * @param schemaSetName schema set name
106      */
107     void updateAnchorSchemaSet(String dataspaceName, String anchorName, String schemaSetName);
108 }