当前位置: 首页>>代码示例>>Python>>正文


Python extensions.os_compute_authorizer函数代码示例

本文整理汇总了Python中nova.api.openstack.extensions.os_compute_authorizer函数的典型用法代码示例。如果您正苦于以下问题:Python os_compute_authorizer函数的具体用法?Python os_compute_authorizer怎么用?Python os_compute_authorizer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了os_compute_authorizer函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ServiceController

#    License for the specific language governing permissions and limitations
#    under the License.

import webob.exc

from nova.api.openstack.compute.schemas.v3 import services
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api import validation
from nova import compute
from nova import exception
from nova.i18n import _
from nova import servicegroup

ALIAS = "os-services"
authorize = extensions.os_compute_authorizer(ALIAS)


class ServiceController(wsgi.Controller):

    def __init__(self):
        self.host_api = compute.HostAPI()
        self.servicegroup_api = servicegroup.API()

    def _get_services(self, req):
        context = req.environ['nova.context']
        authorize(context)
        _services = self.host_api.service_get_all(context, set_zones=True)

        host = ''
        if 'host' in req.GET:
开发者ID:tomatoXu,项目名称:nova,代码行数:31,代码来源:services.py

示例2: test_os_compute_api_authorizer_throws_exception_if_policy_fails

 def test_os_compute_api_authorizer_throws_exception_if_policy_fails(self):
     authorize = base_extensions.os_compute_authorizer(
         'used_limits_for_admin')
     self._test_extension_authorizer_throws_exception_if_policy_fails(
         "os_compute_api:used_limits_for_admin",
         authorize)
开发者ID:Francis-Liu,项目名称:animated-broccoli,代码行数:6,代码来源:test_extensions.py

示例3: ShelveController

#   License for the specific language governing permissions and limitations
#   under the License.

"""The shelved mode extension."""

from webob import exc

from nova.api.openstack import common
from nova.api.openstack import extensions as exts
from nova.api.openstack import wsgi
from nova import compute
from nova import exception


ALIAS = 'os-shelve'
authorize = exts.os_compute_authorizer(ALIAS)


class ShelveController(wsgi.Controller):
    def __init__(self, *args, **kwargs):
        super(ShelveController, self).__init__(*args, **kwargs)
        self.compute_api = compute.API(skip_policy_check=True)

    @wsgi.response(202)
    @exts.expected_errors((404, 409))
    @wsgi.action('shelve')
    def _shelve(self, req, id, body):
        """Move an instance into shelved mode."""
        context = req.environ["nova.context"]
        authorize(context, action='shelve')
开发者ID:Dynavisor,项目名称:nova,代码行数:30,代码来源:shelve.py

示例4: _translate_volume_detail_view

from oslo_utils import strutils
from webob import exc

from nova.api.openstack import common
from nova.api.openstack.compute.schemas import volumes as volumes_schema
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
from nova.api import validation
from nova import compute
from nova import exception
from nova.i18n import _
from nova import objects
from nova import volume

ALIAS = "os-volumes"
authorize = extensions.os_compute_authorizer(ALIAS)
authorize_attach = extensions.os_compute_authorizer('os-volumes-attachments')


def _translate_volume_detail_view(context, vol):
    """Maps keys for volumes details view."""

    d = _translate_volume_summary_view(context, vol)

    # No additional data / lookups at the moment

    return d


def _translate_volume_summary_view(context, vol):
    """Maps keys for volumes summary view."""
开发者ID:fabian4,项目名称:nova,代码行数:31,代码来源:volumes.py

示例5: authorize

def authorize(context, action_name):
    extensions.os_compute_authorizer(ALIAS)(context, action=action_name)
开发者ID:Milstein,项目名称:nova,代码行数:2,代码来源:migrations.py


注:本文中的nova.api.openstack.extensions.os_compute_authorizer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。