f646a3b87a2fabcc900be5f52c98aa98da6ba904
[sdc.git] / services / activity-spec / activity-spec-web / activity-spec-service / src / main / java / org / openecomp / 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.openecomp.activityspec.api.rest;
18
19 import io.swagger.annotations.Api;
20 import io.swagger.annotations.ApiOperation;
21 import io.swagger.annotations.ApiParam;
22 import org.openecomp.activityspec.api.rest.types.ActivitySpecActionRequestDto;
23 import org.openecomp.activityspec.api.rest.types.ActivitySpecRequestDto;
24 import org.springframework.validation.annotation.Validated;
25
26 import javax.validation.Valid;
27 import javax.ws.rs.Consumes;
28 import javax.ws.rs.GET;
29 import javax.ws.rs.POST;
30 import javax.ws.rs.PUT;
31 import javax.ws.rs.Path;
32 import javax.ws.rs.PathParam;
33 import javax.ws.rs.Produces;
34 import javax.ws.rs.QueryParam;
35 import javax.ws.rs.core.MediaType;
36 import javax.ws.rs.core.Response;
37
38 @Path("/v1.0/activity-spec/")
39 @Produces(MediaType.APPLICATION_JSON)
40 @Consumes(MediaType.APPLICATION_JSON)
41 @Api(value = "Activity Specs")
42 @Validated
43 public interface ActivitySpecs {
44   @POST
45   @Path("/")
46   @ApiOperation(value = "Create Activity Spec")
47   Response createActivitySpec(@Valid ActivitySpecRequestDto request);
48
49   @GET
50   @Path("/{id}/versions/{versionId}")
51   @ApiOperation(value = "Get Activity Spec")
52   Response getActivitySpec(@ApiParam(value = "Activity Spec Id") @PathParam("id")
53                                   String id,
54                               @ApiParam(value = "Version Id") @PathParam("versionId")
55                                   String versionId);
56
57   @PUT
58   @Path("/{id}/versions/{versionId}")
59   @ApiOperation(value = "Update Activity Spec")
60   Response updateActivitySpec(@Valid ActivitySpecRequestDto request,
61                               @ApiParam(value = "Activity Spec Id") @PathParam("id")
62                                   String id,
63                               @ApiParam(value = "Version Id") @PathParam("versionId")
64                                   String versionId);
65
66   @PUT
67   @Path("/{id}/versions/{versionId}/actions")
68   @ApiOperation(value = "Actions on a activity spec",
69       notes = "Performs one of the following actions on a activity spec: |"
70           + "Submit: Finalize its active version.|"
71           + "Deprecate: Deprecate activity spec.|")
72   Response actOnActivitySpec(ActivitySpecActionRequestDto request,
73       @ApiParam(value = "Activity Spec Id") @PathParam("id") String id,
74       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId);
75
76   @GET
77   @Path("/")
78   @ApiOperation(value = "Get list of activity specs ",
79       responseContainer = "List")
80   Response list(@ApiParam(
81       value = "Currently supported values: 'Certified' - only activity specs with Certified status")
82                     @QueryParam("status") String versionStatus);
83 }