push addional code
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-software-products-rest / vendor-software-products-rest-services / src / main / java / org / openecomp / sdcrests / vsp / rest / ComponentUploads.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdcrests.vsp.rest;
22
23 import static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
24 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
25
26 import io.swagger.annotations.Api;
27 import io.swagger.annotations.ApiOperation;
28 import io.swagger.annotations.ApiParam;
29 import org.apache.cxf.jaxrs.ext.multipart.Attachment;
30 import org.apache.cxf.jaxrs.ext.multipart.Multipart;
31 import org.openecomp.sdcrests.vendorsoftwareproducts.types.MibUploadStatusDto;
32 import org.springframework.validation.annotation.Validated;
33
34 import javax.validation.constraints.NotNull;
35 import javax.ws.rs.Consumes;
36 import javax.ws.rs.DELETE;
37 import javax.ws.rs.GET;
38 import javax.ws.rs.HeaderParam;
39 import javax.ws.rs.POST;
40 import javax.ws.rs.Path;
41 import javax.ws.rs.PathParam;
42 import javax.ws.rs.Produces;
43 import javax.ws.rs.core.MediaType;
44 import javax.ws.rs.core.Response;
45
46
47 @Path("/v1.0/vendor-software-products/{vspId}/components/{componentId}/monitors")
48 @Produces(MediaType.APPLICATION_JSON)
49 @Consumes(MediaType.APPLICATION_JSON)
50 @Api(value = "Vendor Software Product Component MIB Uploads")
51 @Validated
52 public interface ComponentUploads {
53   @POST
54   @Path("/snmp-trap/upload")
55   @Consumes(MediaType.MULTIPART_FORM_DATA)
56   @ApiOperation(value = "Upload vendor software product MIB Trap Definitions file")
57   Response uploadTrapMibFile(@Multipart("upload") Attachment attachment,
58                              @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
59                                  String vspId,
60                              @ApiParam(value = "Vendor software product component Id")
61                              @PathParam("componentId") String componentId,
62                              @NotNull(message = USER_MISSING_ERROR_MSG)
63                              @HeaderParam(USER_HEADER_PARAM) String user);
64
65   @DELETE
66   @Path("/snmp-trap")
67   @ApiOperation(value = "Delete vendor software product MIB Trap Definitions file")
68   Response deleteTrapMibFile(
69       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
70       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
71           String componentId,
72       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
73
74   @POST
75   @Path("/snmp/upload")
76   @Consumes(MediaType.MULTIPART_FORM_DATA)
77   @ApiOperation(value = "Upload vendor software product MIB Poll Definitions file")
78   Response uploadPollMibFile(@Multipart("upload") Attachment attachment,
79                              @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
80                                  String vspId,
81                              @ApiParam(value = "Vendor software product component Id")
82                              @PathParam("componentId") String componentId,
83                              @NotNull(message = USER_MISSING_ERROR_MSG)
84                              @HeaderParam(USER_HEADER_PARAM) String user);
85
86   @DELETE
87   @Path("/snmp")
88   @ApiOperation(value = "Delete vendor software product MIB Poll Definitions file")
89   Response deletePollMibFile(
90       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
91       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
92           String componentId,
93       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
94
95   @GET
96   @Path("/snmp/")
97   @ApiOperation(value = "Get the filenames of uploaded MIB definitions",
98       response = MibUploadStatusDto.class)
99   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
100                 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
101                     String componentId,
102                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
103                     String user);
104 }