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


Python Org.get_catalog_access_settings方法代码示例

本文整理汇总了Python中pyvcloud.vcd.org.Org.get_catalog_access_settings方法的典型用法代码示例。如果您正苦于以下问题:Python Org.get_catalog_access_settings方法的具体用法?Python Org.get_catalog_access_settings怎么用?Python Org.get_catalog_access_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyvcloud.vcd.org.Org的用法示例。


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

示例1: info

# 需要导入模块: from pyvcloud.vcd.org import Org [as 别名]
# 或者: from pyvcloud.vcd.org.Org import get_catalog_access_settings [as 别名]
def info(ctx, catalog_name, item_name):
    try:
        restore_session(ctx)
        client = ctx.obj['client']
        in_use_org_href = ctx.obj['profiles'].get('org_href')
        org = Org(client, in_use_org_href)
        if item_name is None:
            catalog = org.get_catalog(catalog_name)
            result = to_dict(catalog)
            # We don't have a way to know in advance if a user has access to a
            # catalog's ACL or not. So we try to retrieve it always. If the
            # call fails due to permission issues, we silently eat the
            # exception and exclude ACL settings from the output of the current
            # command. Users who have access to ACL of the catalog will remain
            # unaffected. Also any other errors/exceptions will bubble up as
            # usual.
            try:
                access_control_settings = access_settings_to_dict(
                    org.get_catalog_access_settings(catalog_name))
                result.update(access_control_settings)
            except AccessForbiddenException as e:
                pass
        else:
            catalog_item = org.get_catalog_item(catalog_name, item_name)
            result = to_dict(catalog_item)
            vapp = VApp(client, href=catalog_item.Entity.get('href'))
            vapp.reload()
            template = vapp_to_dict(vapp.resource)
            for k, v in template.items():
                result['template-%s' % k] = v
        stdout(result, ctx)
    except Exception as e:
        stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:35,代码来源:catalog.py

示例2: test_05_catalog_control_access_retrieval

# 需要导入模块: from pyvcloud.vcd.org import Org [as 别名]
# 或者: from pyvcloud.vcd.org.Org import get_catalog_access_settings [as 别名]
 def test_05_catalog_control_access_retrieval(self):
     org_in_use = self.client.get_org_by_name(
         self.config['vcd']['org_in_use'])
     org = Org(self.client, resource=org_in_use)
     catalog = org.get_catalog(self.config['vcd']['catalog'])
     assert self.config['vcd']['catalog'] == catalog.get('name')
     control_access = org.get_catalog_access_settings(catalog.get('name'))
     assert len(control_access.AccessSettings.AccessSetting) == 3
开发者ID:rdbwebster,项目名称:pyvcloud,代码行数:10,代码来源:vcd_catalog.py

示例3: list_acl

# 需要导入模块: from pyvcloud.vcd.org import Org [as 别名]
# 或者: from pyvcloud.vcd.org.Org import get_catalog_access_settings [as 别名]
def list_acl(ctx, catalog_name):
    try:
        restore_session(ctx)
        client = ctx.obj['client']
        in_use_org_href = ctx.obj['profiles'].get('org_href')
        org = Org(client, in_use_org_href)

        acl = org.get_catalog_access_settings(catalog_name=catalog_name)
        stdout(
            access_settings_to_list(acl,
                                    ctx.obj['profiles'].get('org_in_use')),
            ctx)
    except Exception as e:
        stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:16,代码来源:catalog.py


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