f032d37f9508341b47cffe3c15d3822180bd3762
[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 jakarta.ws.rs.DELETE;
24 import jakarta.ws.rs.POST;
25 import jakarta.ws.rs.Path;
26 import jakarta.ws.rs.Produces;
27 import jakarta.ws.rs.core.Response;
28 import org.onap.policy.models.pdp.concepts.DeploymentGroups;
29 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
30 import org.springframework.web.bind.annotation.RequestBody;
31
32
33 /**
34  * Mock rest endpoints for api and pap servers.
35  */
36 @Path("/")
37 @Produces("application/json")
38 public class MockRestEndpoint {
39
40     /**
41      * Dummy endpoint for create policy types.
42      *
43      * @param body tosca service template
44      * @return the response
45      */
46     @Path("policy/api/v1/policytypes")
47     @POST
48     public Response createPolicyType(@RequestBody ToscaServiceTemplate body) {
49         return Response.status(200).build();
50     }
51
52     /**
53      * Dummy endpoint for create policies.
54      *
55      * @param body tosca service template
56      * @return the response
57      */
58     @Path("policy/api/v1/policies")
59     @POST
60     public Response createPolicy(@RequestBody ToscaServiceTemplate body) {
61         return Response.status(200).build();
62     }
63
64     /**
65      * Dummy endpoint for delete policy types.
66      *
67      * @return the response
68      */
69     @Path("policy/api/v1/policytypes/{policyTypeId}/versions/{versionId}")
70     @DELETE
71     public Response deletePolicyType() {
72         return Response.status(200).build();
73     }
74
75     /**
76      * Dummy endpoint for delete policy.
77      *
78      * @return the response
79      */
80     @Path("policy/api/v1/policies/{policyId}/versions/{versionId}")
81     @DELETE
82     public Response deletePolicy() {
83         return Response.status(200).build();
84     }
85
86     /**
87      * Dummy endpoint for deploy/undeploy policy in pap.
88      *
89      * @param body pdp deployment group
90      * @return the response
91      */
92     @Path("policy/pap/v1/pdps/deployments/batch")
93     @POST
94     public Response handlePolicyDeployOrUndeploy(@RequestBody DeploymentGroups body) {
95         return Response.status(200).build();
96     }
97
98 }