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