1#   Copyright (c) 2016 Stratoscale, Ltd.
2#
3#   Licensed under the Apache License, Version 2.0 (the "License"); you may
4#   not use this file except in compliance with the License. You may obtain
5#   a copy of the License at
6#
7#       http://www.apache.org/licenses/LICENSE-2.0
8#
9#   Unless required by applicable law or agreed to in writing, software
10#   distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11#   WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12#   License for the specific language governing permissions and limitations
13#   under the License.
14
15from six.moves import http_client
16
17from cinder.api.contrib import volume_manage as volume_manage_v2
18from cinder.api import microversions as mv
19from cinder.api.openstack import wsgi
20from cinder.api.v3 import resource_common_manage as common
21
22
23class VolumeManageController(common.ManageResource,
24                             volume_manage_v2.VolumeManageController):
25    def __init__(self, *args, **kwargs):
26        super(VolumeManageController, self).__init__(*args, **kwargs)
27        self._set_resource_type('volume')
28
29    @wsgi.response(http_client.ACCEPTED)
30    def create(self, req, body):
31        self._ensure_min_version(req, mv.MANAGE_EXISTING_LIST)
32        return super(VolumeManageController, self).create(req, body)
33
34
35def create_resource():
36    return wsgi.Resource(VolumeManageController())
37