• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python extensions.os_compute_authorizer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python extensions.os_compute_soft_authorizer函数代码示例发布时间:2022-05-27
下一篇:
Python extensions.extension_authorizer函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap