Add bearer token to NCMP async batch data passthrough (CPS-2126 #4)
[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-2024 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 java.util.Collection;
27 import java.util.Map;
28 import org.onap.cps.ncmp.api.impl.inventory.CompositeState;
29 import org.onap.cps.ncmp.api.impl.operations.OperationType;
30 import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters;
31 import org.onap.cps.ncmp.api.models.CmHandleQueryServiceParameters;
32 import org.onap.cps.ncmp.api.models.DataOperationRequest;
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 given data store using dmi.
55      *
56      * @param datastoreName       datastore name
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      * @param authorization       contents of Authorization header, or null if not present
63      * @return {@code Object} resource data
64      */
65     Object getResourceDataForCmHandle(String datastoreName,
66                                       String cmHandleId,
67                                       String resourceIdentifier,
68                                       String optionsParamInQuery,
69                                       String topicParamInQuery,
70                                       String requestId,
71                                       String authorization);
72
73     /**
74      * Get resource data for operational.
75      *
76      * @param datastoreName      datastore name
77      * @param cmHandleId         cm handle identifier
78      * @param resourceIdentifier resource identifier
79      * @Link FetchDescendantsOption fetch descendants option
80      * @return {@code Object} resource data
81      */
82     Object getResourceDataForCmHandle(String datastoreName,
83                                       String cmHandleId,
84                                       String resourceIdentifier,
85                                       FetchDescendantsOption fetchDescendantsOption);
86
87     /**
88      * Execute (async) data operation for group of cm handles using dmi.
89      *
90      * @param topicParamInQuery        topic name for (triggering) async responses
91      * @param dataOperationRequest     contains a list of operation definitions(multiple operations)
92      * @param requestId                request ID
93      * @param authorization            contents of Authorization header, or null if not present
94      */
95     void executeDataOperationForCmHandles(String topicParamInQuery,
96                                           DataOperationRequest dataOperationRequest,
97                                           String requestId,
98                                           String authorization);
99
100
101     /**
102      * Write resource data for data store pass-through running using dmi for given cm-handle.
103      *
104      * @param cmHandleId         cm handle identifier
105      * @param resourceIdentifier resource identifier
106      * @param operationType      required operation type
107      * @param requestBody        request body to create resource
108      * @param contentType        content type in body
109      * @param authorization       contents of Authorization header, or null if not present
110      * @return {@code Object} return data
111      */
112     Object writeResourceDataPassThroughRunningForCmHandle(String cmHandleId,
113                                                         String resourceIdentifier,
114                                                         OperationType operationType,
115                                                         String requestBody,
116                                                         String contentType,
117                                                         String authorization);
118
119     /**
120      * Retrieve module references for the given cm handle.
121      *
122      * @param cmHandleId cm handle identifier
123      * @return a collection of modules names and revisions
124      */
125     Collection<ModuleReference> getYangResourcesModuleReferences(String cmHandleId);
126
127     /**
128      * Retrieve module definitions for the given cm handle.
129      *
130      * @param cmHandleId cm handle identifier
131      * @return a collection of module definition (moduleName, revision and yang resource content)
132      */
133     Collection<ModuleDefinition> getModuleDefinitionsByCmHandleId(String cmHandleId);
134
135     /**
136      * Get module definitions for the given parameters.
137      *
138      * @param cmHandleId        cm-handle identifier
139      * @param moduleName        module name
140      * @param moduleRevision    the revision of the module
141      * @return list of module definitions (module name, revision, yang resource content)
142      */
143     Collection<ModuleDefinition> getModuleDefinitionsByCmHandleAndModule(String cmHandleId,
144                                                                          String moduleName,
145                                                                          String moduleRevision);
146
147     /**
148      * Query cm handle details by cm handle's name.
149      *
150      * @param cmHandleId cm handle identifier
151      * @return a collection of cm handle details.
152      */
153     NcmpServiceCmHandle getNcmpServiceCmHandle(String cmHandleId);
154
155     /**
156      * Get cm handle public properties by cm handle id.
157      *
158      * @param cmHandleId cm handle identifier
159      * @return a collection of cm handle public properties.
160      */
161     Map<String, String> getCmHandlePublicProperties(String cmHandleId);
162
163     /**
164      * Get cm handle composite state by cm handle id.
165      *
166      * @param cmHandleId cm handle identifier
167      * @return a cm handle composite state
168      */
169     CompositeState getCmHandleCompositeState(String cmHandleId);
170
171     /**
172      * Query and return cm handles that match the given query parameters.
173      *
174      * @param cmHandleQueryApiParameters the cm handle query parameters
175      * @return collection of cm handles
176      */
177     Collection<NcmpServiceCmHandle> executeCmHandleSearch(CmHandleQueryApiParameters cmHandleQueryApiParameters);
178
179     /**
180      * Query and return cm handle ids that match the given query parameters.
181      *
182      * @param cmHandleQueryApiParameters the cm handle query parameters
183      * @return collection of cm handle ids
184      */
185     Collection<String> executeCmHandleIdSearch(CmHandleQueryApiParameters cmHandleQueryApiParameters);
186
187     /**
188      * Set the data sync enabled flag, along with the data sync state to true or false based on the cm handle id.
189      *
190      * @param cmHandleId cm handle id
191      * @param dataSyncEnabled data sync enabled flag
192      */
193     void setDataSyncEnabled(String cmHandleId, Boolean dataSyncEnabled);
194
195     /**
196      * Get all cm handle IDs by DMI plugin identifier.
197      *
198      * @param dmiPluginIdentifier DMI plugin identifier
199      * @return collection of cm handle IDs
200      */
201     Collection<String> getAllCmHandleIdsByDmiPluginIdentifier(String dmiPluginIdentifier);
202
203     /**
204      * Get all cm handle IDs by various search criteria.
205      *
206      * @param cmHandleQueryServiceParameters cm handle query parameters
207      * @return collection of cm handle IDs
208      */
209     Collection<String> executeCmHandleIdSearchForInventory(CmHandleQueryServiceParameters
210                                                                cmHandleQueryServiceParameters);
211 }