bd18223936b7a106ca93d79e6cf52d250b573476
[policy/pap.git] / main / src / main / java / org / onap / policy / pap / main / rest / PapRestControllerV1.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  *  Modifications Copyright (C) 2019 AT&T Intellectual Property.
5  * ================================================================================
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.pap.main.rest;
23
24 import io.swagger.annotations.Api;
25 import io.swagger.annotations.BasicAuthDefinition;
26 import io.swagger.annotations.Info;
27 import io.swagger.annotations.SecurityDefinition;
28 import io.swagger.annotations.SwaggerDefinition;
29 import io.swagger.annotations.Tag;
30 import java.net.HttpURLConnection;
31 import javax.ws.rs.Path;
32 import javax.ws.rs.Produces;
33 import javax.ws.rs.core.MediaType;
34
35 /**
36  * Version v1 common superclass to provide REST endpoints for PAP component.
37  *
38  * @author Ram Krishna Verma (ram.krishna.verma@est.tech)
39  */
40 @Path("/policy/pap/v1")
41 @Api(value = "Policy Administration (PAP) API")
42 @Produces(MediaType.APPLICATION_JSON)
43 @SwaggerDefinition(
44     info = @Info(description =
45                     "Policy Administration is responsible for the deployment life cycle of policies as well as "
46                     + "interworking with the mechanisms required to orchestrate the nodes and containers on which "
47                     + "policies run. It is also responsible for the administration of policies at run time;"
48                     + " ensuring that policies are available to users, that policies are executing correctly,"
49                     + " and that the state and status of policies is monitored", version = "v1.0",
50                     title = "Policy Administration"),
51     consumes = {MediaType.APPLICATION_JSON}, produces = {MediaType.APPLICATION_JSON},
52     schemes = {SwaggerDefinition.Scheme.HTTP, SwaggerDefinition.Scheme.HTTPS},
53     tags = {@Tag(name = "policy-administration", description = "Policy Administration Service Operations")},
54     securityDefinition = @SecurityDefinition(
55                     basicAuthDefinitions = {@BasicAuthDefinition(key = "basicAuth")}))
56 public class PapRestControllerV1 {
57
58     public static final String AUTHORIZATION_TYPE = "basicAuth";
59
60     public static final int AUTHENTICATION_ERROR_CODE = HttpURLConnection.HTTP_UNAUTHORIZED;
61     public static final int AUTHORIZATION_ERROR_CODE = HttpURLConnection.HTTP_FORBIDDEN;
62     public static final int SERVER_ERROR_CODE = HttpURLConnection.HTTP_INTERNAL_ERROR;
63
64     public static final String AUTHENTICATION_ERROR_MESSAGE = "Authentication Error";
65     public static final String AUTHORIZATION_ERROR_MESSAGE = "Authorization Error";
66     public static final String SERVER_ERROR_MESSAGE = "Internal Server Error";
67 }