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