313ae24e95875de719390dd7bb47266f1126b322
[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_ID_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 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/monitors")
47 @Produces(MediaType.APPLICATION_JSON)
48 @Consumes(MediaType.APPLICATION_JSON)
49 @Api(value = "Vendor Software Product Component MIB Uploads")
50 @Validated
51 public interface ComponentUploads extends VspEntities {
52   @POST
53   @Path("/snmp-trap/upload")
54   @Consumes(MediaType.MULTIPART_FORM_DATA)
55   @ApiOperation(value = "Upload vendor software product MIB SNMP_TRAP Definitions file")
56   Response uploadTrapMibFile(@Multipart("upload") Attachment attachment,
57                              @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
58                              @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
59                              @ApiParam(value = "Component Id") @PathParam("componentId") String
60                                  componentId,
61                              @NotNull(message = USER_MISSING_ERROR_MSG)
62                              @HeaderParam(USER_ID_HEADER_PARAM) String user);
63
64   @DELETE
65   @Path("/snmp-trap")
66   @ApiOperation(value = "Delete vendor software product MIB SNMP_TRAP Definitions file")
67   Response deleteTrapMibFile(
68       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
69       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
70       @ApiParam(value = "Component Id") @PathParam("componentId") String componentId,
71       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
72
73   @POST
74   @Path("/snmp/upload")
75   @Consumes(MediaType.MULTIPART_FORM_DATA)
76   @ApiOperation(value = "Upload vendor software product MIB SNMP_POLL Definitions file")
77   Response uploadPollMibFile(@Multipart("upload") Attachment attachment,
78                              @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
79                                  String vspId,
80                              @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
81                              @ApiParam(value = "Vendor software product component Id")
82                              @PathParam("componentId") String componentId,
83                              @NotNull(message = USER_MISSING_ERROR_MSG)
84                              @HeaderParam(USER_ID_HEADER_PARAM) String user);
85
86   @DELETE
87   @Path("/snmp")
88   @ApiOperation(value = "Delete vendor software product MIB SNMP_POLL Definitions file")
89   Response deletePollMibFile(
90       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
91       @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
92       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
93           String componentId,
94       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
95
96
97   // TODO: 2/27/2017 add version
98   @GET
99   @Path("/snmp/")
100   @ApiOperation(value = "Get the filenames of uploaded MIB definitions",
101       response = MibUploadStatusDto.class)
102   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
103                 @ApiParam(value = "Vendor software product version Id") @PathParam("versionId") String versionId,
104                 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
105                     String componentId,
106                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
107                     String user);
108 }