re base code
[sdc.git] / services / activity-spec / activity-spec-web / activity-spec-service / src / main / java / org / onap / sdc / activityspec / api / rest / ActivitySpecs.java
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
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
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.sdc.activityspec.api.rest;
18
19 import io.swagger.annotations.*;
20 import org.onap.sdc.activityspec.api.rest.types.ActivitySpecActionRequestDto;
21 import org.onap.sdc.activityspec.api.rest.types.ActivitySpecRequestDto;
22 import org.springframework.validation.annotation.Validated;
23
24 import javax.validation.Valid;
25 import javax.ws.rs.*;
26 import javax.ws.rs.core.MediaType;
27 import javax.ws.rs.core.Response;
28
29 import static org.onap.sdc.activityspec.utils.ActivitySpecConstant.USER_ID_HEADER_PARAM;
30
31 @Path("/v1.0/activity-spec/")
32 @Produces(MediaType.APPLICATION_JSON)
33 @Consumes(MediaType.APPLICATION_JSON)
34 @Api(value = "Activity Specs")
35 @Validated
36 public interface ActivitySpecs {
37
38     @POST
39     @Path("/")
40     @ApiOperation(value = "Create Activity Spec")
41     @ApiImplicitParams({@ApiImplicitParam(name = USER_ID_HEADER_PARAM, required = true, dataType = "string",
42             paramType = "header")})
43     Response createActivitySpec(@Valid ActivitySpecRequestDto request);
44
45     @GET
46     @Path("/{id}/versions/{versionId}")
47     @ApiOperation(value = "Get Activity Spec")
48     @ApiImplicitParams({@ApiImplicitParam(name = USER_ID_HEADER_PARAM, required = true, dataType = "string",
49             paramType = "header")})
50     Response getActivitySpec(@ApiParam(value = "Activity Spec Id") @PathParam("id") String id,
51                                     @ApiParam(value = "Version Id") @PathParam("versionId") String versionId);
52
53     @PUT
54     @Path("/{id}/versions/{versionId}")
55     @ApiOperation(value = "Update Activity Spec")
56     @ApiImplicitParams({@ApiImplicitParam(name = USER_ID_HEADER_PARAM, required = true, dataType = "string",
57             paramType = "header")})
58     Response updateActivitySpec(@Valid ActivitySpecRequestDto request,
59                                        @ApiParam(value = "Activity Spec Id") @PathParam("id") String id,
60                                        @ApiParam(value = "Version Id") @PathParam("versionId") String versionId);
61
62     @PUT
63     @Path("/{id}/versions/{versionId}/actions")
64     @ApiOperation(value = "Actions on a activity spec",
65             notes = "Performs one of the following actions on a activity spec: |" + "CERTIFY: Certifies activity spec.|"
66                             + "DEPRECATE: Deprecates activity spec.|" + "DELETE: Deletes activity spec.")
67     @ApiImplicitParams({@ApiImplicitParam(name = USER_ID_HEADER_PARAM, required = true, dataType = "string",
68             paramType = "header")})
69     Response actOnActivitySpec(ActivitySpecActionRequestDto request,
70                                       @ApiParam(value = "Activity Spec Id") @PathParam("id") String id,
71                                       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId);
72
73     @GET
74     @Path("/")
75     @ApiOperation(value = "Get list of activity specs ", responseContainer = "List")
76     @ApiImplicitParams({@ApiImplicitParam(name = USER_ID_HEADER_PARAM, required = true, dataType = "string",
77             paramType = "header")})
78     Response list(@ApiParam(value = "List activity specs based on status filter") @QueryParam("status")
79                           String versionStatus);
80 }