Added oparent to sdc main
[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 / Compute.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.annotations.Api;
24 import io.swagger.annotations.ApiOperation;
25 import io.swagger.annotations.ApiParam;
26 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDetailsDto;
27 import org.openecomp.sdcrests.vendorsoftwareproducts.types.ComputeDto;
28 import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
29 import org.openecomp.sdcrests.vendorsoftwareproducts.types.validation.IsValidJson;
30 import org.springframework.validation.annotation.Validated;
31
32 import javax.validation.Valid;
33 import javax.validation.constraints.NotNull;
34 import javax.ws.rs.*;
35 import javax.ws.rs.core.MediaType;
36 import javax.ws.rs.core.Response;
37
38 import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
39 import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
40
41 @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId" +
42     "}/compute-flavors")
43 @Produces(MediaType.APPLICATION_JSON)
44 @Consumes(MediaType.APPLICATION_JSON)
45 @Api(value = "Vendor Software Product Component Compute-flavors")
46 @Validated
47 public interface Compute extends VspEntities {
48
49   @GET
50   @Path("/")
51   @ApiOperation(value = "Get list of vendor software product component compute-flavors",
52       response = ComputeDto.class,
53       responseContainer = "List")
54   Response list(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
55                 @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
56                 @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
57                     String componentId,
58                 @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
59                     String user);
60
61   @GET
62   @Path("/{computeFlavorId}")
63   @ApiOperation(value = "Get vendor software product component compute-flavor",
64       response = ComputeDetailsDto.class,
65       responseContainer = "CompositionEntityResponse")
66   Response get(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
67                @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
68                @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
69                    String componentId,
70                @ApiParam(value = "Vendor software product compute-flavor Id") @PathParam
71                    ("computeFlavorId")
72                    String computeId,
73                @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
74                    String user);
75
76   @POST
77   @Path("/")
78   @ApiOperation(value = "Create a vendor software product component compute-flavor")
79   Response create(@Valid ComputeDetailsDto request,
80                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
81                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
82                   @ApiParam(value = "Vendor software product component Id")
83                   @PathParam("componentId") String componentId,
84                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
85                       String user);
86
87   @PUT
88   @Path("/{computeFlavorId}")
89   @ApiOperation(value = "Update vendor software product component compute-flavor")
90   Response update(@Valid ComputeDetailsDto request,
91                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
92                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
93                   @ApiParam(value = "Vendor software product component Id")
94                   @PathParam("componentId") String componentId,
95                   @ApiParam(value = "Vendor software product compute-flavor Id") @PathParam
96                       ("computeFlavorId")
97                       String computeFlavorId,
98                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
99                       String user);
100
101   @PUT
102   @Path("/{computeFlavorId}/questionnaire")
103   @ApiOperation(value = "Update vendor software product component compute-flavor questionnaire")
104   Response updateQuestionnaire(@NotNull @IsValidJson String questionnaireData,
105                   @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
106                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
107                   @ApiParam(value = "Vendor software product component Id")
108                   @PathParam("componentId") String componentId,
109                   @ApiParam(value = "Vendor software product compute-flavor Id") @PathParam
110                       ("computeFlavorId")
111                       String computeFlavorId,
112                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
113                       String user);
114
115   @DELETE
116   @Path("/{computeFlavorId}")
117   @ApiOperation(value = "Delete vendor software product component compute-flavor")
118   Response delete(@ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
119                   @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
120                   @ApiParam(value = "Vendor software product component Id")
121                   @PathParam("componentId") String componentId,
122                   @ApiParam(value = "Vendor software product compute-flavor Id") @PathParam
123                       ("computeFlavorId")
124                       String computeFlavorId,
125                   @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM)
126                       String user);
127
128   @GET
129   @Path("/{computeFlavorId}/questionnaire")
130   @ApiOperation(value = "Get vendor software product component compute-flavor questionnaire",
131       response = QuestionnaireResponseDto.class)
132   Response getQuestionnaire(
133       @ApiParam(value = "Vendor software product Id") @PathParam("vspId") String vspId,
134       @ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
135       @ApiParam(value = "Vendor software product component Id") @PathParam("componentId")
136           String componentId,
137       @ApiParam(value = "Vendor software product compute-flavor Id") @PathParam
138           ("computeFlavorId") String computeId,
139       @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
140 }