2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.sdc.activityspec.api.rest;
19 import io.swagger.annotations.Api;
20 import io.swagger.annotations.ApiOperation;
21 import io.swagger.annotations.ApiParam;
22 import io.swagger.annotations.ApiImplicitParam;
23 import io.swagger.annotations.ApiImplicitParams;
24 import org.onap.sdc.activityspec.api.rest.types.ActivitySpecActionRequestDto;
25 import org.onap.sdc.activityspec.api.rest.types.ActivitySpecRequestDto;
26 import org.springframework.validation.annotation.Validated;
28 import javax.validation.Valid;
29 import javax.ws.rs.Consumes;
30 import javax.ws.rs.GET;
31 import javax.ws.rs.POST;
32 import javax.ws.rs.PUT;
33 import javax.ws.rs.Path;
34 import javax.ws.rs.PathParam;
35 import javax.ws.rs.Produces;
36 import javax.ws.rs.QueryParam;
37 import javax.ws.rs.core.MediaType;
38 import javax.ws.rs.core.Response;
40 import static org.onap.sdc.activityspec.utils.ActivitySpecConstant.USER_ID_HEADER_PARAM;
42 @Path("/v1.0/activity-spec/")
43 @Produces(MediaType.APPLICATION_JSON)
44 @Consumes(MediaType.APPLICATION_JSON)
45 @Api(value = "Activity Specs")
47 public interface ActivitySpecs {
51 @ApiOperation(value = "Create Activity Spec")
52 @ApiImplicitParams({@ApiImplicitParam(name = USER_ID_HEADER_PARAM, required = true, dataType = "string",
53 paramType = "header")})
54 Response createActivitySpec(@Valid ActivitySpecRequestDto request);
57 @Path("/{id}/versions/{versionId}")
58 @ApiOperation(value = "Get Activity Spec")
59 @ApiImplicitParams({@ApiImplicitParam(name = USER_ID_HEADER_PARAM, required = true, dataType = "string",
60 paramType = "header")})
61 Response getActivitySpec(@ApiParam(value = "Activity Spec Id") @PathParam("id") String id,
62 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId);
65 @Path("/{id}/versions/{versionId}")
66 @ApiOperation(value = "Update Activity Spec")
67 @ApiImplicitParams({@ApiImplicitParam(name = USER_ID_HEADER_PARAM, required = true, dataType = "string",
68 paramType = "header")})
69 Response updateActivitySpec(@Valid ActivitySpecRequestDto request,
70 @ApiParam(value = "Activity Spec Id") @PathParam("id") String id,
71 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId);
74 @Path("/{id}/versions/{versionId}/actions")
75 @ApiOperation(value = "Actions on a activity spec",
76 notes = "Performs one of the following actions on a activity spec: |" + "CERTIFY: Certifies activity spec.|"
77 + "DEPRECATE: Deprecates activity spec.|" + "DELETE: Deletes activity spec.")
78 @ApiImplicitParams({@ApiImplicitParam(name = USER_ID_HEADER_PARAM, required = true, dataType = "string",
79 paramType = "header")})
80 Response actOnActivitySpec(ActivitySpecActionRequestDto request,
81 @ApiParam(value = "Activity Spec Id") @PathParam("id") String id,
82 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId);
86 @ApiOperation(value = "Get list of activity specs ", responseContainer = "List")
87 @ApiImplicitParams({@ApiImplicitParam(name = USER_ID_HEADER_PARAM, required = true, dataType = "string",
88 paramType = "header")})
89 Response list(@ApiParam(value = "List activity specs based on status filter") @QueryParam("status")
90 String versionStatus);