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.action.rest;
23 import io.swagger.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import org.apache.cxf.jaxrs.ext.multipart.Attachment;
26 import org.apache.cxf.jaxrs.ext.multipart.Multipart;
27 import org.openecomp.sdcrests.action.types.ActionResponseDto;
28 import org.springframework.validation.annotation.Validated;
30 import javax.servlet.http.HttpServletRequest;
32 import javax.ws.rs.core.Context;
33 import javax.ws.rs.core.MediaType;
34 import javax.ws.rs.core.Response;
37 * Defines various CRUD API that can be performed on Action.
39 @Path("/workflow/v1.0/actions")
40 @Produces(MediaType.APPLICATION_JSON)
41 @Consumes(MediaType.APPLICATION_JSON)
42 @Api(value = "Actions")
44 public interface Actions {
47 * List All Major, Last Minor and Candidate version if any for Given Action Invariant UuId
49 * @return List of All Major, Last Minor and Candidate version if any Of Action with given
50 actionInvariantUuId. If actionUuId is provided then only action with given actionInvariantUuId
54 @Path("/{actionInvariantUuId}")
55 @ApiOperation(value = "List Actions For Given Action Invariant UuId", responseContainer = "List")
56 Response getActionsByActionInvariantUuId(
57 @PathParam("actionInvariantUuId") String actionInvariantUuId,
58 @QueryParam("version") String actionUuId, @Context HttpServletRequest servletRequest);
61 * Get list of actions based on a filter criteria. If no filter is sent all actions will be
64 * @return List Of Last Major and Last Minor of All Actions based on filter criteria
67 @ApiOperation(value = "List Filtered Actions ",
68 notes = "Get list of actions based on a filter criteria | If no filter is sent all actions "
70 responseContainer = "List")
71 Response getFilteredActions(@QueryParam("vendor") String vendor,
72 @QueryParam("category") String category,
73 @QueryParam("name") String name,
74 @QueryParam("modelId") String modelId,
75 @QueryParam("componentId") String componentId,
76 @Context HttpServletRequest servletRequest);
79 * List OPENECOMP Components supported by Action Library.
81 * @return List of OPENECOMP Components supported by Action Library
85 @ApiOperation(value = "List OPENECOMP Components supported by Action Library",
86 responseContainer = "List")
87 Response getOpenEcompComponents(@Context HttpServletRequest servletRequest);
90 * Create a new Action based on request JSON.
92 * @return Metadata object {@link ActionResponseDto ActionResponseDto} object for created Action
95 @ApiOperation(value = "Create a new Action")
96 Response createAction(String requestJson, @Context HttpServletRequest servletRequest);
99 * Update an existing action with parameters provided in requestJson.
101 * @return Metadata object {@link ActionResponseDto ActionResponseDto} object for created Action
104 @Path("/{actionInvariantUuId}")
105 @ApiOperation(value = "Update an existing action")
106 Response updateAction(@PathParam("actionInvariantUuId") String actionInvariantUuId,
107 String requestJson, @Context HttpServletRequest servletRequest);
112 * @param actionInvariantUuId Invariant UuId of the action to be deleted
113 * @param servletRequest Servlet request object
114 * @return Empty response object
117 @Path("/{actionInvariantUuId}")
118 @ApiOperation(value = "Delete Action")
119 Response deleteAction(@PathParam("actionInvariantUuId") String actionInvariantUuId,
120 @Context HttpServletRequest servletRequest);
123 * Performs Checkout/Undo_Checkout/Checkin/Submit Operation on Action.
125 * @return Metadata object {@link ActionResponseDto ActionResponseDto} object for created Action
128 @Path("/{actionInvariantUuId}")
129 @ApiOperation(value = "Actions on a action",
130 notes = "Performs one of the following actions on a action: |"
131 + "Checkout: Locks it for edits by other users. Only the locking user sees the edited "
133 + "Undo_Checkout: Unlocks it and deletes the edits that were done.|"
134 + "Checkin: Unlocks it and activates the edited version to all users.| "
135 + "Submit: Finalize its active version.|")
136 Response actOnAction(@PathParam("actionInvariantUuId") String actionInvariantUuId,
137 String requestJson, @Context HttpServletRequest servletRequest);
140 * Upload an artifact to an action.
142 * @param actionInvariantUuId Invariant UuId of the action to which the artifact is uploaded
143 * @param artifactName Name of the artifact
144 * @param artifactLabel Label of the artifact
145 * @param artifactCategory Category of the artifact
146 * @param artifactDescription Description of the artifact
147 * @param artifactProtection Artifact protection mode
148 * @param checksum Checksum of the artifact
149 * @param artifactToUpload Artifact content object
150 * @param servletRequest Servlet request object
151 * @return Generated UuId of the uploaded artifact
154 @Path("/{actionInvariantUuId}/artifacts")
155 @Consumes(MediaType.MULTIPART_FORM_DATA)
156 Response uploadArtifact(@PathParam("actionInvariantUuId") String actionInvariantUuId,
157 @Multipart(value = "artifactName", required = false) String artifactName,
158 @Multipart(value = "artifactLabel", required = false) String artifactLabel,
159 @Multipart(value = "artifactCategory", required = false) String artifactCategory,
160 @Multipart(value = "artifactDescription", required = false) String artifactDescription,
161 @Multipart(value = "artifactProtection", required = false) String artifactProtection,
162 @HeaderParam("Content-MD5") String checksum,
163 @Multipart(value = "uploadArtifact", required = false) Attachment artifactToUpload,
164 @Context HttpServletRequest servletRequest);
167 @Path("/{actionUuId}/artifacts/{artifactUuId}")
168 @Produces(MediaType.APPLICATION_OCTET_STREAM)
169 @ApiOperation(value = "Downloads artifact for action")
170 Response downloadArtifact(@PathParam("actionUuId") String actionUuId,
171 @PathParam("artifactUuId") String artifactUuId,
172 @Context HttpServletRequest servletRequest);
175 @Path("/{actionInvariantUuId}/artifacts/{artifactUuId}")
176 @ApiOperation(value = "Delete Artifact")
177 Response deleteArtifact(@PathParam("actionInvariantUuId") String actionInvariantUuId,
178 @PathParam("artifactUuId") String artifactUuId,
179 @Context HttpServletRequest servletRequest);
182 @Path("/{actionInvariantUuId}/artifacts/{artifactUuId}")
183 @Consumes(MediaType.MULTIPART_FORM_DATA)
184 Response updateArtifact(@PathParam("actionInvariantUuId") String actionInvariantUuId,
185 @PathParam("artifactUuId") String artifactUuId,
186 @Multipart(value = "artifactName", required = false) String artifactName,
187 @Multipart(value = "artifactLabel", required = false) String artifactLabel,
188 @Multipart(value = "artifactCategory", required = false) String artifactCategory,
189 @Multipart(value = "artifactDescription", required = false) String artifactDescription,
190 @Multipart(value = "artifactProtection", required = false) String artifactProtection,
191 @HeaderParam("Content-MD5") String checksum,
192 @Multipart(value = "updateArtifact", required = false) Attachment artifactToUpdate,
193 @Context HttpServletRequest servletRequest);