57fbb53000298761d99340034523104cf6af21dd
[sdnc/apps.git] /
1 /*
2  * ============LICENSE_START===================================================
3  * Copyright (c) 2018 Amdocs
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 package org.onap.sdnc.apps.pomba.networkdiscovery.service.rs;
19
20 import io.swagger.annotations.Api;
21 import io.swagger.annotations.ApiOperation;
22 import io.swagger.annotations.ApiParam;
23 import io.swagger.annotations.ApiResponse;
24 import io.swagger.annotations.ApiResponses;
25 import io.swagger.annotations.Authorization;
26 import java.util.List;
27 import javax.servlet.http.HttpServletRequest;
28 import javax.ws.rs.Consumes;
29 import javax.ws.rs.GET;
30 import javax.ws.rs.HeaderParam;
31 import javax.ws.rs.Path;
32 import javax.ws.rs.PathParam;
33 import javax.ws.rs.Produces;
34 import javax.ws.rs.QueryParam;
35 import javax.ws.rs.core.Context;
36 import javax.ws.rs.core.HttpHeaders;
37 import javax.ws.rs.core.MediaType;
38 import javax.ws.rs.core.Response;
39 import org.onap.logging.ref.slf4j.ONAPLogConstants;
40 import org.onap.sdnc.apps.pomba.networkdiscovery.ApplicationException;
41 import org.onap.sdnc.apps.pomba.networkdiscovery.datamodel.NetworkDiscoveryResponse;
42
43
44 @Api(protocols="http", tags= {"resource"})
45 @Path("{version: v1}/network")
46 @Produces(MediaType.APPLICATION_JSON)
47 public interface RestService {
48
49     public static final String SERVICE_NAME = "network-discovery";
50
51     @GET
52     @Path("/resource")
53     @Produces(MediaType.APPLICATION_JSON)
54     @Consumes(MediaType.APPLICATION_JSON)
55     @ApiOperation(
56             value = "Get Network Information",
57             notes = "Retrieve information from primary data sources",
58             response = NetworkDiscoveryResponse.class,
59             authorizations = @Authorization("basicAuth")
60     )
61     @ApiResponses(
62             value = {
63                     @ApiResponse(code = 200, message = "Request has completed and no more information is forthcoming."),
64                     @ApiResponse(code = 202, message = "Request has been accepted and more information will be posted to notificationURL."),
65                     @ApiResponse(code = 400, message = "Missing mandatory field in the request or HTTP header."),
66                     @ApiResponse(code = 404, message = "Requested resource was not found."),
67                     @ApiResponse(code = 500, message = "Request failed due to internal error")
68             })
69     public Response findbyResourceIdAndType(@Context
70                                             HttpServletRequest request,
71
72                                             @PathParam("version")
73                                             @ApiParam(required=true, defaultValue="v1", allowableValues="v1")
74                                             String version,
75
76                                             @HeaderParam(HttpHeaders.AUTHORIZATION)
77                                             @ApiParam(hidden=true)
78                                             String authorization,
79
80                                             @HeaderParam(ONAPLogConstants.Headers.PARTNER_NAME)
81                                             @ApiParam(required=true)
82                                             String xFromAppId,
83
84                                             @HeaderParam(ONAPLogConstants.Headers.REQUEST_ID)
85                                             String xTransactionId,
86
87                                             @QueryParam("requestId")
88                                             @ApiParam(required=true)
89                                             String requestId,
90
91                                             @QueryParam("resourceType")
92                                             @ApiParam(required=true)
93                                             String resourceType,
94
95                                             @QueryParam("resourceId")
96                                             @ApiParam(required=true)
97                                             List<String> resourceIds,
98
99                                             @QueryParam("notificationURL")
100                                             @ApiParam(required=true)
101                                             String notificationURL) throws ApplicationException;
102
103 }