a9137addb4
this change implements the initial v2 experimental api. it is implemented as an optional series of class that can be configured through the paste deploy configuration file. * add wsgi auth validator * add middleware router * add v2 endpoints * add v2 flask blueprint object * add optional paste filter and composite * add developer docs for v2 api Change-Id: I74627c0879851b354b5043f8a6ff91bae8438bb1 Partial-Implements: bp v2-api-experimental-impl
32 lines
1.1 KiB
Python
32 lines
1.1 KiB
Python
# Copyright (c) 2016 Red Hat, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
# implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
from sahara.api import acl
|
|
from sahara.service.edp import api
|
|
import sahara.utils.api as u
|
|
|
|
|
|
rest = u.RestV2('job-types', __name__)
|
|
|
|
|
|
@rest.get('/job-types')
|
|
@acl.enforce("data-processing:job-types:get_all")
|
|
def job_types_get():
|
|
# We want to use flat=False with to_dict() so that
|
|
# the value of each arg is given as a list. This supports
|
|
# filters of the form ?type=Pig&type=Java, etc.
|
|
return u.render(job_types=api.get_job_types(
|
|
**u.get_request_args().to_dict(flat=False)))
|