9f56a29ca20431f0cb757be37d9ee9decb6eb735
[policy/clamp.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2022 Nordix Foundation.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.clamp.acm.participant.policy.main.utils;
22
23 import io.swagger.annotations.ApiParam;
24 import javax.ws.rs.DELETE;
25 import javax.ws.rs.POST;
26 import javax.ws.rs.Path;
27 import javax.ws.rs.Produces;
28 import javax.ws.rs.core.Response;
29 import org.onap.policy.models.pdp.concepts.DeploymentGroups;
30 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
31 import org.springframework.web.bind.annotation.RequestBody;
32
33
34 /**
35  * Mock rest endpoints for api and pap servers.
36  */
37 @Path("/")
38 @Produces("application/json")
39 public class MockRestEndpoint {
40
41     /**
42      * Dummy endpoint for create policy types.
43      *
44      * @param body tosca service template
45      * @return the response
46      */
47     @Path("policy/api/v1/policytypes")
48     @POST
49     public Response createPolicyType(
50             @RequestBody @ApiParam(value = "Entity body", required = true) ToscaServiceTemplate body) {
51         return Response.status(200).build();
52     }
53
54     /**
55      * Dummy endpoint for create policies.
56      *
57      * @param body tosca service template
58      * @return the response
59      */
60     @Path("policy/api/v1/policies")
61     @POST
62     public Response createPolicy(
63             @RequestBody @ApiParam(value = "Entity body ", required = true) ToscaServiceTemplate body) {
64         return Response.status(200).build();
65     }
66
67     /**
68      * Dummy endpoint for delete policy types.
69      *
70      * @return the response
71      */
72     @Path("policy/api/v1/policytypes/{policyTypeId}/versions/{versionId}")
73     @DELETE
74     public Response deletePolicyType() {
75         return Response.status(200).build();
76     }
77
78     /**
79      * Dummy endpoint for delete policy.
80      *
81      * @return the response
82      */
83     @Path("policy/api/v1/policies/{policyId}/versions/{versionId}")
84     @DELETE
85     public Response deletePolicy() {
86         return Response.status(200).build();
87     }
88
89     /**
90      * Dummy endpoint for deploy/undeploy policy in pap.
91      *
92      * @param body pdp deployment group
93      * @return the response
94      */
95     @Path("policy/pap/v1/pdps/deployments/batch")
96     @POST
97     public Response handlePolicyDeployOrUndeploy(
98             @RequestBody @ApiParam(value = "Entity body", required = true) DeploymentGroups body) {
99         return Response.status(200).build();
100     }
101
102 }