Changes while processing optimation policy
[optf/osdf.git] / osdf / __init__.py
1 # -------------------------------------------------------------------------
2 #   Copyright (c) 2015-2018 AT&T Intellectual Property
3 #
4 #   Licensed under the Apache License, Version 2.0 (the "License");
5 #   you may not use this file except in compliance with the License.
6 #   You may obtain a copy of the License at
7 #
8 #       http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #   Unless required by applicable law or agreed to in writing, software
11 #   distributed under the License is distributed on an "AS IS" BASIS,
12 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #   See the License for the specific language governing permissions and
14 #   limitations under the License.
15 #
16 # -------------------------------------------------------------------------
17 #
18
19 """Core functions for OSDF Application, including flask app"""
20
21 from jinja2 import Template
22
23
24 end_point_auth_mapping = {  # map a URL endpoint to auth group
25     "cmscheduler": "CMScheduler",
26     "placement": "Placement",
27 }
28
29 userid_suffix, passwd_suffix = "Username", "Password"
30 auth_groups = set(end_point_auth_mapping.values())
31
32 ERROR_TEMPLATE = Template("""
33 {
34      "serviceException": {
35         "text": "{{ description }}"
36      }
37 }
38 """)
39
40 ACCEPTED_MESSAGE_TEMPLATE = Template("""
41 {
42    "requestId": "{{ request_id }}",
43    "transactionId": "{{ transaction_id }}",
44    "requestStatus": "{{ request_status }}",
45    "statusMessage": "{{ status_message }}"
46 }
47 """)