Query based on Public CM Properties
[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.Set;
30 import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters;
31 import org.onap.cps.ncmp.api.models.DmiPluginRegistration;
32 import org.onap.cps.ncmp.api.models.DmiPluginRegistrationResponse;
33 import org.onap.cps.ncmp.api.models.NcmpServiceCmHandle;
34 import org.onap.cps.spi.model.ModuleReference;
35
36 /*
37  * Datastore interface for handling CPS data.
38  */
39 public interface NetworkCmProxyDataService {
40
41     /**
42      * Registration of New CM Handles.
43      *
44      * @param dmiPluginRegistration Dmi Plugin Registration
45      * @return dmiPluginRegistrationResponse
46      */
47     DmiPluginRegistrationResponse updateDmiRegistrationAndSyncModule(DmiPluginRegistration dmiPluginRegistration);
48
49     /**
50      * Get resource data for data store pass-through operational
51      * using dmi.
52      *
53      * @param cmHandleId cm handle identifier
54      * @param resourceIdentifier resource identifier
55      * @param optionsParamInQuery options query
56      * @param topicParamInQuery topic name for (triggering) async responses
57      * @param requestId unique requestId for async request
58      * @return {@code Object} resource data
59      */
60     Object getResourceDataOperationalForCmHandle(String cmHandleId,
61                                                  String resourceIdentifier,
62                                                  String optionsParamInQuery,
63                                                  String topicParamInQuery,
64                                                  String requestId);
65
66     /**
67      * Get resource data for data store pass-through running
68      * using dmi.
69      *
70      * @param cmHandleId cm handle identifier
71      * @param resourceIdentifier resource identifier
72      * @param optionsParamInQuery options query
73      * @param topicParamInQuery topic name for (triggering) async responses
74      * @param requestId unique requestId for async request
75      * @return {@code Object} resource data
76      */
77     Object getResourceDataPassThroughRunningForCmHandle(String cmHandleId,
78                                                         String resourceIdentifier,
79                                                         String optionsParamInQuery,
80                                                         String topicParamInQuery,
81                                                         String requestId);
82
83     /**
84      * Write resource data for data store pass-through running
85      * using dmi for given cm-handle.
86      *  @param cmHandleId cm handle identifier
87      * @param resourceIdentifier resource identifier
88      * @param operation required operation
89      * @param requestBody request body to create resource
90      * @param contentType content type in body
91      * @return {@code Object} return data
92      */
93     Object writeResourceDataPassThroughRunningForCmHandle(String cmHandleId,
94                                                         String resourceIdentifier,
95                                                         OperationEnum operation,
96                                                         String requestBody,
97                                                         String contentType);
98
99     /**
100      * Retrieve module references for the given cm handle.
101      *
102      * @param cmHandleId cm handle identifier
103      * @return a collection of modules names and revisions
104      */
105     Collection<ModuleReference> getYangResourcesModuleReferences(String cmHandleId);
106
107     /**
108      * Query cm handle identifiers for the given collection of module names.
109      *
110      * @param moduleNames module names.
111      * @return a collection of cm handle identifiers. The schema set for each cm handle must include all the
112      *         given module names
113      */
114     Collection<String> executeCmHandleHasAllModulesSearch(Collection<String> moduleNames);
115
116     /**
117      * Query cm handle details by cm handle's name.
118      *
119      * @param cmHandleId cm handle identifier
120      * @return a collection of cm handle details.
121      */
122     NcmpServiceCmHandle getNcmpServiceCmHandle(String cmHandleId);
123
124     /**
125      * Query and return cm handles that match the given query parameters.
126      *
127      * @param cmHandleQueryApiParameters the cm handle query parameters
128      * @return collection of cm handle ids
129      */
130     Set<String> queryCmHandles(CmHandleQueryApiParameters cmHandleQueryApiParameters);
131 }