[SDC-29] Amdocs OnBoard 1707 initial commit.
[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 / Components.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 io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
27 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
28 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRequestDto;
29 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
30 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
31 import org.springframework.validation.annotation.Validated;
32
33 import javax.validation.Valid;
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.PUT;
41 import javax.ws.rs.Path;
42 import javax.ws.rs.PathParam;
43 import javax.ws.rs.Produces;
44 import javax.ws.rs.core.MediaType;
45 import javax.ws.rs.core.Response;
46
47 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
48 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
49
50 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components")
51 @Produces(MediaType.APPLICATION_JSON)
52 @Consumes(MediaType.APPLICATION_JSON)
53 @Api(value = "Vendor Software Product Components")
54 @Validated
55 public interface Components extends VspEntities {
56   @GET
57   @Path("/")
58   @ApiOperation(value = "List vendor software product components",
59       response = ComponentDto.class,
60       responseContainer = "List")
61   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
62                 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
63                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
64                     String user);
65
66   @DELETE
67   @Path("/")
68   @ApiOperation(value = "Delete vendor software product components",
69       responseContainer = "List")
70   Response deleteList(
71       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
72       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
73       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
74
75   @POST
76   @Path("/")
77   @ApiOperation(value = "Create a vendor software product component")
78   Response create(@Valid ComponentRequestDto request,
79                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
80                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
81                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
82                       String user);
83
84   @GET
85   @Path("/{componentId}")
86   @ApiOperation(value = "Get vendor software product component",
87       response = ComponentData.class,
88       responseContainer = "CompositionEntityResponse")
89   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
90                @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
91                @ApiParam(value = "Vendor software product component Id")
92                @PathParam("componentId") String componentId,
93                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
94                    String user);
95
96   @DELETE
97   @Path("/{componentId}")
98   @ApiOperation(value = "Delete vendor software product component")
99   Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
100                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
101                   @ApiParam(value = "Vendor software product component Id")
102                   @PathParam("componentId") String componentId,
103                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
104                       String user);
105
106   @PUT
107   @Path("/{componentId}")
108   @ApiOperation(value = "Update vendor software product component")
109   Response update(@Valid ComponentRequestDto request,
110                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
111                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
112                   @ApiParam(value = "Vendor software product component Id")
113                   @PathParam("componentId") String componentId,
114                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
115                       String user);
116
117   @GET
118   @Path("/{componentId}/questionnaire")
119   @ApiOperation(value = "Get vendor software product component questionnaire",
120       response = QuestionnaireResponseDto.class)
121   Response getQuestionnaire(
122       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
123       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
124       @ApiParam(value = "Vendor software product component Id")
125       @PathParam("componentId") String componentId,
126       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
127
128   @PUT
129   @Path("/{componentId}/questionnaire")
130   @ApiOperation(value = "Update vendor software product component questionnaire")
131   Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
132                                @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
133                                    String vspId,
134                                @ApiParam(value = "Version Id") @PathParam("versionId")
135                                    String versionId,
136                                @ApiParam(value = "Vendor software product component Id")
137                                @PathParam("componentId") String componentId,
138                                @NotNull(message = USER_MISSING_ERROR_MSG)
139                                @HeaderParam(USER_ID_HEADER_PARAM) String user);
140 }