2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdcrests.vsp.rest;
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;
33 import javax.validation.Valid;
34 import javax.validation.constraints.NotNull;
36 import javax.ws.rs.core.MediaType;
37 import javax.ws.rs.core.Response;
39 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
40 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
42 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components")
43 @Produces(MediaType.APPLICATION_JSON)
44 @Consumes(MediaType.APPLICATION_JSON)
45 @Api(value = "Vendor Software Product Components")
47 public interface Components extends VspEntities {
50 @ApiOperation(value = "List vendor software product components",
51 response = ComponentDto.class,
52 responseContainer = "List")
53 Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
54 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
55 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
60 @ApiOperation(value = "Delete vendor software product components",
61 responseContainer = "List")
63 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
64 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
65 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
69 @ApiOperation(value = "Create a vendor software product component")
70 Response create(@Valid ComponentRequestDto request,
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)
77 @Path("/{componentId}")
78 @ApiOperation(value = "Get vendor software product component",
79 response = ComponentData.class,
80 responseContainer = "CompositionEntityResponse")
81 Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
82 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
83 @ApiParam(value = "Vendor software product component Id")
84 @PathParam("componentId") String componentId,
85 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
89 @Path("/{componentId}")
90 @ApiOperation(value = "Delete vendor software product component")
91 Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
92 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
93 @ApiParam(value = "Vendor software product component Id")
94 @PathParam("componentId") String componentId,
95 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
99 @Path("/{componentId}")
100 @ApiOperation(value = "Update vendor software product component")
101 Response update(@Valid ComponentRequestDto request,
102 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
103 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
104 @ApiParam(value = "Vendor software product component Id")
105 @PathParam("componentId") String componentId,
106 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
110 @Path("/{componentId}/questionnaire")
111 @ApiOperation(value = "Get vendor software product component questionnaire",
112 response = QuestionnaireResponseDto.class)
113 Response getQuestionnaire(
114 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
115 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
116 @ApiParam(value = "Vendor software product component Id")
117 @PathParam("componentId") String componentId,
118 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
121 @Path("/{componentId}/questionnaire")
122 @ApiOperation(value = "Update vendor software product component questionnaire")
123 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
124 @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
126 @ApiParam(value = "Version Id") @PathParam("versionId")
128 @ApiParam(value = "Vendor software product component Id")
129 @PathParam("componentId") String componentId,
130 @NotNull(message = USER_MISSING_ERROR_MSG)
131 @HeaderParam(USER_ID_HEADER_PARAM) String user);