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 static org.openecomp.sdcrests.common.RestConstants.USER_HEADER_PARAM;
24 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
26 import io.swagger.annotations.Api;
27 import io.swagger.annotations.ApiOperation;
28 import io.swagger.annotations.ApiParam;
29 import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
30 import org.openecomp.sdc.versioning.dao.types.Version;
31 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDto;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentRequestDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
34 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
35 import org.springframework.validation.annotation.Validated;
37 import javax.validation.Valid;
38 import javax.validation.constraints.NotNull;
39 import javax.validation.constraints.Pattern;
40 import javax.ws.rs.Consumes;
41 import javax.ws.rs.DELETE;
42 import javax.ws.rs.GET;
43 import javax.ws.rs.HeaderParam;
44 import javax.ws.rs.POST;
45 import javax.ws.rs.PUT;
46 import javax.ws.rs.Path;
47 import javax.ws.rs.PathParam;
48 import javax.ws.rs.Produces;
49 import javax.ws.rs.QueryParam;
50 import javax.ws.rs.core.MediaType;
51 import javax.ws.rs.core.Response;
53 @Path("/v1.0/vendor-software-products/{vspId}/components")
54 @Produces(MediaType.APPLICATION_JSON)
55 @Consumes(MediaType.APPLICATION_JSON)
56 @Api(value = "Vendor Software Product Components")
58 public interface Components {
61 @ApiOperation(value = "List vendor software product components",
62 response = ComponentDto.class,
63 responseContainer = "List")
64 Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
65 @Pattern(regexp = Version.VERSION_REGEX,
66 message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
68 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
73 @ApiOperation(value = "Delete vendor software product components",
74 responseContainer = "List")
76 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
77 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
81 @ApiOperation(value = "Create a vendor software product component")
82 Response create(@Valid ComponentRequestDto request,
83 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
84 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
88 @Path("/{componentId}")
89 @ApiOperation(value = "Get vendor software product component",
90 response = ComponentData.class,
91 responseContainer = "CompositionEntityResponse")
92 Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
93 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
95 @Pattern(regexp = Version.VERSION_REGEX,
96 message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
98 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
102 @Path("/{componentId}")
103 @ApiOperation(value = "Delete vendor software product component")
104 Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
105 @ApiParam(value = "Vendor software product component Id")
106 @PathParam("componentId") String componentId,
107 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
111 @Path("/{componentId}")
112 @ApiOperation(value = "Update vendor software product component")
113 Response update(@Valid ComponentRequestDto request,
114 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
115 @ApiParam(value = "Vendor software product component Id")
116 @PathParam("componentId") String componentId,
117 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
121 @Path("/{componentId}/questionnaire")
122 @ApiOperation(value = "Get vendor software product component questionnaire",
123 response = QuestionnaireResponseDto.class)
124 Response getQuestionnaire(
125 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
126 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
128 @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
129 @QueryParam("version") String version,
130 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
133 @Path("/{componentId}/questionnaire")
134 @ApiOperation(value = "Update vendor software product component questionnaire")
135 Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
136 @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
138 @ApiParam(value = "Vendor software product component Id")
139 @PathParam("componentId") String componentId,
140 @NotNull(message = USER_MISSING_ERROR_MSG)
141 @HeaderParam(USER_HEADER_PARAM) String user);