f6c5486b4d66a968bf94630dba83e1b908b9b7b5
[sdc.git] /
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.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;
27
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;
39
40 import static org.onap.sdc.activityspec.utils.ActivitySpecConstant.USER_ID_HEADER_PARAM;
41
42 @Path("/v1.0/activity-spec/")
43 @Produces(MediaType.APPLICATION_JSON)
44 @Consumes(MediaType.APPLICATION_JSON)
45 @Api(value = "Activity Specs")
46 @Validated
47 public interface ActivitySpecs {
48
49     @POST
50     @Path("/")
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);
55
56     @GET
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);
63
64     @PUT
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);
72
73     @PUT
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);
83
84     @GET
85     @Path("/")
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);
91 }