Implement SOL002 specific changes to CSIT vnfm-simulator
[integration/csit.git] / plans / so / integration-etsi-testing / so-simulators / vnfm-simulator / vnfm-service / src / main / java / org / onap / so / svnfm / simulator / api / VeVnfmApi.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * Copyright (C) 2019 Samsung. All rights reserved.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  * ============LICENSE_END=========================================================
17  */
18
19 package org.onap.so.svnfm.simulator.api;
20
21 import com.squareup.okhttp.Call;
22 import com.squareup.okhttp.Response;
23 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.*;
24 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.api.DefaultApi;
25 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
26
27 import java.util.ArrayList;
28 import java.util.HashMap;
29 import java.util.List;
30 import java.util.Map;
31
32 public class VeVnfmApi extends DefaultApi {
33
34     public VeVnfmApi(final ApiClient apiClient) {
35         super(apiClient);
36     }
37
38     public Call lcnVnfLcmOperationOccurrenceNotificationPostCall(
39             final VnfLcmOperationOccurrenceNotification vnfLcmOperationOccurrenceNotification,
40             final String contentType, final String authorization,
41             final ProgressResponseBody.ProgressListener progressListener,
42             final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
43         return lcnVnfObjectNotificationPostCall(vnfLcmOperationOccurrenceNotification,
44                 contentType, authorization, progressListener, progressRequestListener);
45     }
46
47     private Call lcnVnfObjectNotificationPostCall(
48             final Object body, final String contentType, final String authorization,
49             final ProgressResponseBody.ProgressListener progressListener,
50             final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException {
51         final List<Pair> localVarQueryParams = new ArrayList<>();
52         final List<Pair> localVarCollectionQueryParams = new ArrayList<>();
53         final Map<String, String> localVarHeaderParams = new HashMap<>();
54
55         if (authorization != null) {
56             localVarHeaderParams.put("Authorization", getApiClient().parameterToString(authorization));
57         }
58
59         if (contentType != null) {
60             localVarHeaderParams.put("Content-Type", getApiClient().parameterToString(contentType));
61         }
62
63         final String[] localVarAccepts = new String[]{"application/json"};
64         final String localVarAccept = getApiClient().selectHeaderAccept(localVarAccepts);
65
66         if (localVarAccept != null) {
67             localVarHeaderParams.put("Accept", localVarAccept);
68         }
69
70         final String[] localVarContentTypes = new String[]{"application/json"};
71         final String localVarContentType = getApiClient().selectHeaderContentType(localVarContentTypes);
72         localVarHeaderParams.put("Content-Type", localVarContentType);
73
74         if (progressListener != null) {
75             getApiClient().getHttpClient().networkInterceptors().add(ch -> {
76                 final Response originalResponse = ch.proceed(ch.request());
77                 return originalResponse.newBuilder().body(new ProgressResponseBody(originalResponse.body(), progressListener)).build();
78             });
79         }
80
81         final Map<String, Object> localVarFormParams = new HashMap<>();
82         final String[] localVarAuthNames = new String[0];
83
84         return getApiClient().buildCall("", "POST", localVarQueryParams, localVarCollectionQueryParams, body, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener);
85     }
86 }