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.apache.cxf.jaxrs.ext.multipart.Attachment;
30 import org.apache.cxf.jaxrs.ext.multipart.Multipart;
31 import org.openecomp.sdc.versioning.dao.types.Version;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
33 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
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}/processes")
54 @Produces(MediaType.APPLICATION_JSON)
55 @Consumes(MediaType.APPLICATION_JSON)
56 @Api(value = "Vendor Software Product Processes")
58 public interface Processes {
61 @ApiOperation(value = "List vendor software product processes",
62 response = ProcessEntityDto.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 processes",
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 process")
82 Response create(@Valid ProcessRequestDto request,
83 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
84 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
89 @ApiOperation(value = "Get vendor software product process",
90 response = ProcessEntityDto.class)
91 Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
92 @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
94 @Pattern(regexp = Version.VERSION_REGEX,
95 message = Version.VERSION_STRING_VIOLATION_MSG) @QueryParam("version")
97 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
101 @Path("/{processId}")
102 @ApiOperation(value = "Delete vendor software product process")
103 Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
104 @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
106 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
110 @Path("/{processId}")
111 @ApiOperation(value = "Update vendor software product process")
112 Response update(@Valid ProcessRequestDto request,
113 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
114 @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
116 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)
120 @Path("/{processId}/upload")
121 @Produces(MediaType.APPLICATION_OCTET_STREAM)
122 @ApiOperation(value = "Get vendor software product process uploaded file")
123 Response getUploadedFile(
124 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
125 @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
127 @Pattern(regexp = Version.VERSION_REGEX, message = Version.VERSION_STRING_VIOLATION_MSG)
128 @QueryParam("version") String version,
129 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
132 @Path("/{processId}/upload")
133 @ApiOperation(value = "Delete vendor software product process uploaded file")
134 Response deleteUploadedFile(
135 @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
136 @ApiParam(value = "Vendor software product process Id") @PathParam("processId")
138 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM) String user);
141 @Path("/{processId}/upload")
142 @Consumes(MediaType.MULTIPART_FORM_DATA)
143 @ApiOperation(value = "Update vendor software product process upload")
144 Response uploadFile(@Multipart("upload") Attachment attachment,
145 @ApiParam(value = "Vendor software product Id") @PathParam("vspId")
147 @ApiParam(value = "Vendor software product process Id")
148 @PathParam("processId") String processId,
149 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_HEADER_PARAM)