1 # -------------------------------------------------------------------------
2 # Copyright (c) 2015-2018 AT&T Intellectual Property
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 # -------------------------------------------------------------------------
19 """Core functions for OSDF Application, including flask app"""
21 from jinja2 import Template
23 end_point_auth_mapping = { # map a URL endpoint to auth group
24 "cmscheduler": "CMScheduler",
25 "placement": "Placement",
27 "optmodel": "OptEngine",
28 "optengine": "OptEngine"
31 userid_suffix, passwd_suffix = "Username", "Password"
32 auth_groups = set(end_point_auth_mapping.values())
34 ERROR_TEMPLATE = Template("""
37 "text": "{{ description }}"
42 ACCEPTED_MESSAGE_TEMPLATE = Template("""
44 "requestId": "{{ request_id }}",
45 "transactionId": "{{ transaction_id }}",
46 "requestStatus": "{{ request_status }}",
47 "statusMessage": "{{ status_message }}"