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