re base code
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / action-library-rest / action-library-rest-services / src / main / java / org / openecomp / sdcrests / action / rest / ActionsForSwaggerFileUpload.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.action.rest;
22
23 import com.sun.jersey.multipart.FormDataParam;
24 import io.swagger.annotations.Api;
25 import io.swagger.annotations.ApiOperation;
26 import org.apache.cxf.jaxrs.ext.multipart.Multipart;
27 import org.springframework.validation.annotation.Validated;
28
29 import javax.servlet.http.HttpServletRequest;
30 import javax.ws.rs.*;
31 import javax.ws.rs.core.Context;
32 import javax.ws.rs.core.MediaType;
33 import javax.ws.rs.core.Response;
34 import java.io.InputStream;
35
36
37 @Path("/workflow/v1.0/actions")
38 @Produces(MediaType.APPLICATION_JSON)
39 @Consumes(MediaType.APPLICATION_JSON)
40 @Api(value = "Actions")
41 @Validated
42 public interface ActionsForSwaggerFileUpload {
43
44   /**
45    * Upload an artifact to an action.
46    *
47    * @param actionInvariantUuId Invariant UuId of the action to which the artifact is uploaded
48    * @param artifactName        Name of the artifact
49    * @param artifactLabel       Label of the artifact
50    * @param artifactCategory    Category of the artifact
51    * @param artifactDescription Description  of the artifact
52    * @param artifactProtection  Artifact protection mode
53    * @param checksum            Checksum of the artifact
54    * @param artifactToUpload    Artifact content object
55    * @param servletRequest      Servlet request object
56    * @return Generated UuId of the uploaded artifact
57    */
58   @POST
59   @Path("/{actionInvariantUuId}/artifacts")
60   @ApiOperation(value = "Upload new Artifact")
61   @Consumes(MediaType.MULTIPART_FORM_DATA)
62   Response uploadArtifact(@PathParam("actionInvariantUuId") String actionInvariantUuId,
63                           @Multipart(value = "artifactName", required = false) String artifactName,
64                           @Multipart(value = "artifactLabel", required = false)
65                               String artifactLabel,
66                           @Multipart(value = "artifactCategory", required = false)
67                               String artifactCategory,
68                           @Multipart(value = "artifactDescription", required = false)
69                               String artifactDescription,
70                           @Multipart(value = "artifactProtection", required = false)
71                               String artifactProtection,
72                           @HeaderParam("Content-MD5") String checksum,
73                           @FormDataParam(value = "uploadArtifact") InputStream artifactToUpload,
74                           @Context HttpServletRequest servletRequest);
75
76
77   @PUT
78   @Path("/{actionInvariantUuId}/artifacts/{artifactUuId}")
79   @ApiOperation(value = "Update an existing artifact")
80   @Consumes(MediaType.MULTIPART_FORM_DATA)
81   Response updateArtifact(@PathParam("actionInvariantUuId") String actionInvariantUuId,
82                           @PathParam("artifactUuId") String artifactUuId,
83                           @Multipart(value = "artifactName", required = false) String artifactName,
84                           @Multipart(value = "artifactLabel", required = false)
85                               String artifactLabel,
86                           @Multipart(value = "artifactCategory", required = false)
87                               String artifactCategory,
88                           @Multipart(value = "artifactDescription", required = false)
89                               String artifactDescription,
90                           @Multipart(value = "artifactProtection", required = false)
91                               String artifactProtection,
92                           @HeaderParam("Content-MD5") String checksum,
93                           @FormDataParam(value = "updateArtifact") InputStream artifactToUpdate,
94                           @Context HttpServletRequest servletRequest);
95
96 }