Publish swagger files for SDC APIs
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / conflict-rest / conflict-rest-services / src / main / java / org / openecomp / sdcrests / conflict / rest / Conflicts.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2019 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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdcrests.conflict.rest;
22
23 import io.swagger.v3.oas.annotations.Operation;
24 import io.swagger.v3.oas.annotations.Parameter;
25 import io.swagger.v3.oas.annotations.info.Info;
26 import io.swagger.v3.oas.annotations.media.Content;
27 import io.swagger.v3.oas.annotations.media.Schema;
28 import io.swagger.v3.oas.annotations.responses.ApiResponse;
29 import io.swagger.v3.oas.annotations.tags.Tag;
30 import io.swagger.v3.oas.annotations.tags.Tags;
31 import org.openecomp.sdcrests.common.RestConstants;
32 import org.openecomp.sdcrests.conflict.types.ConflictDto;
33 import org.openecomp.sdcrests.conflict.types.ConflictResolutionDto;
34 import org.openecomp.sdcrests.conflict.types.ItemVersionConflictDto;
35 import org.springframework.validation.annotation.Validated;
36
37 import javax.validation.constraints.NotNull;
38 import javax.ws.rs.*;
39 import javax.ws.rs.core.MediaType;
40 import javax.ws.rs.core.Response;
41
42 @Path("/v1.0/items/{itemId}/versions/{versionId}/conflicts")
43 @Produces(MediaType.APPLICATION_JSON)
44 @Consumes(MediaType.APPLICATION_JSON)
45 @Tags({@Tag(name = "SDCE-1 APIs"), @Tag(name = "Item Version Conflicts")})
46 @Validated
47 public interface Conflicts {
48
49   @GET
50   @Path("/")
51   @Operation(description = "item version conflicts",
52       summary = "Item version private copy conflicts against its public copy",
53           responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ItemVersionConflictDto.class))))
54   Response getConflict(@Parameter(description = "Item Id") @PathParam("itemId") String itemId,
55                        @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
56                        @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
57                         @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
58
59   @GET
60   @Path("/{conflictId}")
61   @Operation(description = "Gets item version conflict",
62       summary = "Gets an item version private copy conflict against its public copy",
63           responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConflictDto.class))))
64   Response getConflict(@Parameter(description = "Item Id") @PathParam("itemId") String itemId,
65                        @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
66                        @Parameter(description = "Version Id") @PathParam("conflictId") String conflictId,
67                        @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
68                        @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
69
70   @PUT
71   @Path("/{conflictId}")
72   @Operation(description = "Resolves item version conflict",
73       summary = "Resolves an item version private copy conflict against its public copy")
74   Response resolveConflict(ConflictResolutionDto conflictResolution,
75                            @Parameter(description = "Item Id") @PathParam("itemId") String itemId,
76                            @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
77                            @Parameter(description = "Version Id") @PathParam("conflictId") String conflictId,
78                            @NotNull(message = RestConstants.USER_MISSING_ERROR_MSG)
79                            @HeaderParam(RestConstants.USER_ID_HEADER_PARAM) String user);
80 }