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