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