2b467557a61962cf286f8429cdd644b8d6b3ab25
[sdc.git] / openecomp-be / api / openecomp-sdc-rest-webapp / vendor-software-products-rest / vendor-software-products-rest-services / src / main / java / org / openecomp / sdcrests / vsp / rest / ComponentDependencies.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.vsp.rest;
22
23 import io.swagger.v3.oas.annotations.OpenAPIDefinition;
24 import io.swagger.v3.oas.annotations.Operation;
25 import io.swagger.v3.oas.annotations.Parameter;
26 import io.swagger.v3.oas.annotations.info.Info;
27 import io.swagger.v3.oas.annotations.media.ArraySchema;
28 import io.swagger.v3.oas.annotations.media.Content;
29 import io.swagger.v3.oas.annotations.media.Schema;
30 import io.swagger.v3.oas.annotations.responses.ApiResponse;
31 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyModel;
32 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComponentDependencyResponseDto;
33 import org.springframework.validation.annotation.Validated;
34
35 import javax.validation.Valid;
36 import javax.validation.constraints.NotNull;
37 import javax.ws.rs.*;
38 import javax.ws.rs.core.MediaType;
39 import javax.ws.rs.core.Response;
40
41 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
42 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
43
44 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/component-dependencies")
45 @Produces(MediaType.APPLICATION_JSON)
46 @Consumes(MediaType.APPLICATION_JSON)
47 @OpenAPIDefinition(info = @Info(title = "Vendor Software Product Component Dependencies"))
48 @Validated
49 public interface ComponentDependencies extends VspEntities {
50
51   @POST
52   @Path("/")
53   @Operation( description= "Create a vendor software product component dependency")
54   Response create(@Valid ComponentDependencyModel request,
55                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
56                   @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
57                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
58                       String user);
59
60   @GET
61   @Path("/")
62   @Operation(description = "Get component dependencies for vendor software product", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = ComponentDependencyResponseDto.class)))))
63   Response list(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
64                 @Parameter(description = "Vendor software product version Id") @PathParam("versionId")
65                     String versionId,
66                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
67                     String user);
68
69   @DELETE
70   @Path("/{dependencyId}")
71   @Operation(description = "Delete component dependency for vendor software product")
72   Response delete(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
73                   @Parameter(description = "Vendor software product version Id")
74                   @PathParam("versionId") String versionId,
75                   @Parameter(description = "Vendor software product Component Dependency Id") @PathParam
76                       ("dependencyId") String dependencyId,
77                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
78                       String user);
79
80   @PUT
81   @Path("/{dependencyId}")
82   @Operation(description = "Update component dependency for vendor software product")
83   Response update(@Valid ComponentDependencyModel request,
84                   @Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
85                   @Parameter(description = "Vendor software product version Id") @PathParam("versionId")
86                       String versionId,
87                   @Parameter(description = "Vendor software product Component Dependency Id") @PathParam
88                       ("dependencyId") String dependencyId,
89                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
90                       String user);
91
92   @GET
93   @Path("/{dependencyId}")
94   @Operation(description = "Get component dependency for vendor software product", responses = @ApiResponse(content = @Content(schema = @Schema(implementation =ComponentDependencyResponseDto.class))))
95   Response get(@Parameter(description = "Vendor software product Id") @PathParam("vspId") String vspId,
96                @Parameter(description = "Version Id") @PathParam("versionId") String versionId,
97                @Parameter(description = "Vendor software product Component Dependency Id") @PathParam
98                    ("dependencyId") String dependencyId,
99                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
100                    String user);
101 }