Add collaboration feature
[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 / Compute.java
1 package org.openecomp.sdcrests.vsp.rest;
2
3 import io.swagger.annotations.Api;
4 import io.swagger.annotations.ApiOperation;
5 import io.swagger.annotations.ApiParam;
6 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDetailsDto;
7 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDto;
8 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
9 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
10 import org.springframework.validation.annotation.Validated;
11
12 import javax.validation.Valid;
13 import javax.validation.constraints.NotNull;
14 import javax.ws.rs.Consumes;
15 import javax.ws.rs.DELETE;
16 import javax.ws.rs.GET;
17 import javax.ws.rs.HeaderParam;
18 import javax.ws.rs.POST;
19 import javax.ws.rs.PUT;
20 import javax.ws.rs.Path;
21 import javax.ws.rs.PathParam;
22 import javax.ws.rs.Produces;
23 import javax.ws.rs.core.MediaType;
24 import javax.ws.rs.core.Response;
25
26 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
27 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
28
29 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId" +
30     "}/compute-flavors")
31 @Produces(MediaType.APPLICATION_JSON)
32 @Consumes(MediaType.APPLICATION_JSON)
33 @Api(value = "Vendor Software Product Component Compute-flavors")
34 @Validated
35 public interface Compute extends VspEntities {
36
37   @GET
38   @Path("/")
39   @ApiOperation(value = "Get list of vendor software product component compute-flavors",
40       response = ComputeDto.class,
41       responseContainer = "List")
42   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
43                 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
44                 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
45                     String componentId,
46                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
47                     String user);
48
49   @GET
50   @Path("/{computeFlavorId}")
51   @ApiOperation(value = "Get vendor software product component compute-flavor",
52       response = ComputeDetailsDto.class,
53       responseContainer = "CompositionEntityResponse")
54   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
55                @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
56                @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
57                    String componentId,
58                @ApiParam(value = "Vendor software product compute-flavor Id") @PathParam
59                    ("computeFlavorId")
60                    String computeId,
61                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
62                    String user);
63
64   @POST
65   @Path("/")
66   @ApiOperation(value = "Create a vendor software product component compute-flavor")
67   Response create(@Valid ComputeDetailsDto request,
68                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
69                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
70                   @ApiParam(value = "Vendor software product component Id")
71                   @PathParam("componentId") String componentId,
72                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
73                       String user);
74
75   @PUT
76   @Path("/{computeFlavorId}")
77   @ApiOperation(value = "Update vendor software product component compute-flavor")
78   Response update(@Valid ComputeDetailsDto request,
79                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
80                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
81                   @ApiParam(value = "Vendor software product component Id")
82                   @PathParam("componentId") String componentId,
83                   @ApiParam(value = "Vendor software product compute-flavor Id") @PathParam
84                       ("computeFlavorId")
85                       String computeFlavorId,
86                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
87                       String user);
88
89   @PUT
90   @Path("/{computeFlavorId}/questionnaire")
91   @ApiOperation(value = "Update vendor software product component compute-flavor questionnaire")
92   Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
93                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
94                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
95                   @ApiParam(value = "Vendor software product component Id")
96                   @PathParam("componentId") String componentId,
97                   @ApiParam(value = "Vendor software product compute-flavor Id") @PathParam
98                       ("computeFlavorId")
99                       String computeFlavorId,
100                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
101                       String user);
102
103   @DELETE
104   @Path("/{computeFlavorId}")
105   @ApiOperation(value = "Delete vendor software product component compute-flavor")
106   Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
107                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
108                   @ApiParam(value = "Vendor software product component Id")
109                   @PathParam("componentId") String componentId,
110                   @ApiParam(value = "Vendor software product compute-flavor Id") @PathParam
111                       ("computeFlavorId")
112                       String computeFlavorId,
113                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
114                       String user);
115
116   @GET
117   @Path("/{computeFlavorId}/questionnaire")
118   @ApiOperation(value = "Get vendor software product component compute-flavor questionnaire",
119       response = QuestionnaireResponseDto.class)
120   Response getQuestionnaire(
121       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
122       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
123       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
124           String componentId,
125       @ApiParam(value = "Vendor software product compute-flavor Id") @PathParam
126           ("computeFlavorId") String computeId,
127       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
128 }