Merge "Added API to get all schema sets for a given dataspace."
[cps.git] / cps-ncmp-service / src / main / java / org / onap / cps / ncmp / api / NetworkCmProxyDataService.java
1 /*
2  *  ============LICENSE_START=======================================================
3  *  Copyright (C) 2021 highstreet technologies GmbH
4  *  Modifications Copyright (C) 2021-2022 Nordix Foundation
5  *  Modifications Copyright (C) 2021 Pantheon.tech
6  *  Modifications Copyright (C) 2022 Bell Canada
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.ncmp.api;
25
26 import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum;
27
28 import java.util.Collection;
29 import java.util.Map;
30 import java.util.Set;
31 import org.onap.cps.ncmp.api.inventory.CompositeState;
32 import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters;
33 import org.onap.cps.ncmp.api.models.CmHandleQueryServiceParameters;
34 import org.onap.cps.ncmp.api.models.DmiPluginRegistration;
35 import org.onap.cps.ncmp.api.models.DmiPluginRegistrationResponse;
36 import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle;
37 import org.onap.cps.spi.FetchDescendantsOption;
38 import org.onap.cps.spi.model.ModuleDefinition;
39 import org.onap.cps.spi.model.ModuleReference;
40
41 /*
42  * Datastore interface for handling CPS data.
43  */
44 public interface NetworkCmProxyDataService {
45
46     /**
47      * Registration of New CM Handles.
48      *
49      * @param dmiPluginRegistration Dmi Plugin Registration
50      * @return dmiPluginRegistrationResponse
51      */
52     DmiPluginRegistrationResponse updateDmiRegistrationAndSyncModule(DmiPluginRegistration dmiPluginRegistration);
53
54     /**
55      * Get resource data for data store pass-through operational
56      * using dmi.
57      *
58      * @param cmHandleId cm handle identifier
59      * @param resourceIdentifier resource identifier
60      * @param optionsParamInQuery options query
61      * @param topicParamInQuery topic name for (triggering) async responses
62      * @param requestId unique requestId for async request
63      * @return {@code Object} resource data
64      */
65     Object getResourceDataOperationalForCmHandle(String cmHandleId,
66                                                  String resourceIdentifier,
67                                                  String optionsParamInQuery,
68                                                  String topicParamInQuery,
69                                                  String requestId);
70
71     /**
72      * Get resource data for operational.
73      *
74      * @param cmHandleId cm handle identifier
75      * @param resourceIdentifier resource identifier
76      * @Link FetchDescendantsOption fetch descendants option
77      * @return {@code Object} resource data
78      */
79     Object getResourceDataOperational(String cmHandleId,
80                                       String resourceIdentifier,
81                                       FetchDescendantsOption fetchDescendantsOption);
82
83     /**
84      * Get resource data for data store pass-through running
85      * using dmi.
86      *
87      * @param cmHandleId cm handle identifier
88      * @param resourceIdentifier resource identifier
89      * @param optionsParamInQuery options query
90      * @param topicParamInQuery topic name for (triggering) async responses
91      * @param requestId unique requestId for async request
92      * @return {@code Object} resource data
93      */
94     Object getResourceDataPassThroughRunningForCmHandle(String cmHandleId,
95                                                         String resourceIdentifier,
96                                                         String optionsParamInQuery,
97                                                         String topicParamInQuery,
98                                                         String requestId);
99
100     /**
101      * Write resource data for data store pass-through running
102      * using dmi for given cm-handle.
103      *  @param cmHandleId cm handle identifier
104      * @param resourceIdentifier resource identifier
105      * @param operation required operation
106      * @param requestBody request body to create resource
107      * @param contentType content type in body
108      * @return {@code Object} return data
109      */
110     Object writeResourceDataPassThroughRunningForCmHandle(String cmHandleId,
111                                                         String resourceIdentifier,
112                                                         OperationEnum operation,
113                                                         String requestBody,
114                                                         String contentType);
115
116     /**
117      * Retrieve module references for the given cm handle.
118      *
119      * @param cmHandleId cm handle identifier
120      * @return a collection of modules names and revisions
121      */
122     Collection<ModuleReference> getYangResourcesModuleReferences(String cmHandleId);
123
124     /**
125      * Retrieve module definitions for the given cm handle.
126      *
127      * @param cmHandleId cm handle identifier
128      * @return a collection of module definition (moduleName, revision and yang resource content)
129      */
130     Collection<ModuleDefinition> getModuleDefinitionsByCmHandleId(String cmHandleId);
131
132     /**
133      * Query cm handle details by cm handle's name.
134      *
135      * @param cmHandleId cm handle identifier
136      * @return a collection of cm handle details.
137      */
138     NcmpServiceCmHandle getNcmpServiceCmHandle(String cmHandleId);
139
140     /**
141      * Get cm handle public properties by cm handle id.
142      *
143      * @param cmHandleId cm handle identifier
144      * @return a collection of cm handle public properties.
145      */
146     Map<String, String> getCmHandlePublicProperties(String cmHandleId);
147
148     /**
149      * Get cm handle composite state by cm handle id.
150      *
151      * @param cmHandleId cm handle identifier
152      * @return a cm handle composite state
153      */
154     CompositeState getCmHandleCompositeState(String cmHandleId);
155
156     /**
157      * Query and return cm handles that match the given query parameters.
158      *
159      * @param cmHandleQueryApiParameters the cm handle query parameters
160      * @return collection of cm handles
161      */
162     Set<NcmpServiceCmHandle> executeCmHandleSearch(CmHandleQueryApiParameters cmHandleQueryApiParameters);
163
164     /**
165      * Query and return cm handle ids that match the given query parameters.
166      *
167      * @param cmHandleQueryApiParameters the cm handle query parameters
168      * @return collection of cm handle ids
169      */
170     Set<String> executeCmHandleIdSearch(CmHandleQueryApiParameters cmHandleQueryApiParameters);
171
172     /**
173      * Set the data sync enabled flag, along with the data sync state to true or false based on the cm handle id.
174      *
175      * @param cmHandleId cm handle id
176      * @param dataSyncEnabled data sync enabled flag
177      */
178     void setDataSyncEnabled(String cmHandleId, boolean dataSyncEnabled);
179
180     /**
181      * Get all cm handle IDs by DMI plugin identifier.
182      *
183      * @param dmiPluginIdentifier DMI plugin identifier
184      * @return set of cm handle IDs
185      */
186     Set<String> getAllCmHandleIdsByDmiPluginIdentifier(String dmiPluginIdentifier);
187
188     /**
189      * Get all cm handle IDs by various search criteria.
190      *
191      * @param cmHandleQueryServiceParameters cm handle query parameters
192      * @return set of cm handle IDs
193      */
194     Set<String> executeCmHandleIdSearchForInventory(CmHandleQueryServiceParameters cmHandleQueryServiceParameters);
195 }