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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.clamp.acm.element.main.rest;
23 import javax.ws.rs.core.MediaType;
24 import org.springframework.web.bind.annotation.RequestMapping;
27 * Common superclass to provide REST endpoints for the AC element.
31 value = "/onap/policy/clamp/acelement/v2",
33 MediaType.APPLICATION_JSON,
34 AbstractRestController.APPLICATION_YAML
38 public abstract class AbstractRestController {
39 public static final String APPLICATION_YAML = "application/yaml";
41 public static final String API_VERSION_NAME = "api-version";
43 public static final String VERSION_MINOR_NAME = "X-MinorVersion";
44 public static final String VERSION_MINOR_DESCRIPTION =
45 "Used to request or communicate a MINOR version back from the client"
46 + " to the server, and from the server back to the client";
48 public static final String VERSION_PATCH_NAME = "X-PatchVersion";
49 public static final String VERSION_PATCH_DESCRIPTION = "Used only to communicate a PATCH version in a response for"
50 + " troubleshooting purposes only, and will not be provided by" + " the client on request";
52 public static final String VERSION_LATEST_NAME = "X-LatestVersion";
53 public static final String VERSION_LATEST_DESCRIPTION = "Used only to communicate an API's latest version";
55 public static final String REQUEST_ID_NAME = "X-ONAP-RequestID";
56 public static final String REQUEST_ID_HDR_DESCRIPTION = "Used to track REST transactions for logging purpose";
58 public static final String OK_CODE = "200";
59 public static final String CREATED_CODE = "201";
60 public static final String NO_CONTENT_CODE = "204";
61 public static final String AUTHENTICATION_ERROR_CODE = "401";
62 public static final String BAD_REQUEST_ERROR_CODE = "400";
64 public static final String AUTHENTICATION_ERROR_MESSAGE = "Authentication Error";
65 public static final String BAD_REQUEST_ERROR_MESSAGE = "Bad request";
66 public static final String SERVER_OK_MESSAGE = "Success";