Add collaboration feature
[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.Consumes;
31 import javax.ws.rs.HeaderParam;
32 import javax.ws.rs.POST;
33 import javax.ws.rs.PUT;
34 import javax.ws.rs.Path;
35 import javax.ws.rs.PathParam;
36 import javax.ws.rs.Produces;
37 import javax.ws.rs.core.Context;
38 import javax.ws.rs.core.MediaType;
39 import javax.ws.rs.core.Response;
40 import java.io.InputStream;
41
42
43 @Path("/workflow/v1.0/actions")
44 @Produces(MediaType.APPLICATION_JSON)
45 @Consumes(MediaType.APPLICATION_JSON)
46 @Api(value = "Actions")
47 @Validated
48 public interface ActionsForSwaggerFileUpload {
49
50   /**
51    * Upload an artifact to an action.
52    *
53    * @param actionInvariantUuId Invariant UuId of the action to which the artifact is uploaded
54    * @param artifactName        Name of the artifact
55    * @param artifactLabel       Label of the artifact
56    * @param artifactCategory    Category of the artifact
57    * @param artifactDescription Description  of the artifact
58    * @param artifactProtection  Artifact protection mode
59    * @param checksum            Checksum of the artifact
60    * @param artifactToUpload    Artifact content object
61    * @param servletRequest      Servlet request object
62    * @return Generated UuId of the uploaded artifact
63    */
64   @POST
65   @Path("/{actionInvariantUuId}/artifacts")
66   @ApiOperation(value = "Upload new Artifact")
67   @Consumes(MediaType.MULTIPART_FORM_DATA)
68   Response uploadArtifact(@PathParam("actionInvariantUuId") String actionInvariantUuId,
69                           @Multipart(value = "artifactName", required = false) String artifactName,
70                           @Multipart(value = "artifactLabel", required = false)
71                               String artifactLabel,
72                           @Multipart(value = "artifactCategory", required = false)
73                               String artifactCategory,
74                           @Multipart(value = "artifactDescription", required = false)
75                               String artifactDescription,
76                           @Multipart(value = "artifactProtection", required = false)
77                               String artifactProtection,
78                           @HeaderParam("Content-MD5") String checksum,
79                           @FormDataParam(value = "uploadArtifact") InputStream artifactToUpload,
80                           @Context HttpServletRequest servletRequest);
81
82
83   @PUT
84   @Path("/{actionInvariantUuId}/artifacts/{artifactUuId}")
85   @ApiOperation(value = "Update an existing artifact")
86   @Consumes(MediaType.MULTIPART_FORM_DATA)
87   Response updateArtifact(@PathParam("actionInvariantUuId") String actionInvariantUuId,
88                           @PathParam("artifactUuId") String artifactUuId,
89                           @Multipart(value = "artifactName", required = false) String artifactName,
90                           @Multipart(value = "artifactLabel", required = false)
91                               String artifactLabel,
92                           @Multipart(value = "artifactCategory", required = false)
93                               String artifactCategory,
94                           @Multipart(value = "artifactDescription", required = false)
95                               String artifactDescription,
96                           @Multipart(value = "artifactProtection", required = false)
97                               String artifactProtection,
98                           @HeaderParam("Content-MD5") String checksum,
99                           @FormDataParam(value = "updateArtifact") InputStream artifactToUpdate,
100                           @Context HttpServletRequest servletRequest);
101
102 }