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


Python Org.share_catalog_with_org_members方法代码示例

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


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

示例1: share_catalog

# 需要导入模块: from pyvcloud.vcd.org import Org [as 别名]
# 或者: from pyvcloud.vcd.org.Org import share_catalog_with_org_members [as 别名]
    def share_catalog(cls):
        """Shares the test catalog with all members in the test organization.

        :raises: Exception: if the class variable _org_href is not populated.
        :raises: EntityNotFoundException: if the catalog in question is
            missing.
        """
        cls._basic_check()
        if cls._org_href is None:
            raise Exception('Org ' + cls._config['vcd']['default_org_name'] +
                            ' doesn\'t exist.')

        try:
            catalog_author_client = Environment.get_client_in_default_org(
                CommonRoles.CATALOG_AUTHOR)
            org = Org(catalog_author_client, href=cls._org_href)
            catalog_name = cls._config['vcd']['default_catalog_name']
            catalog_records = org.list_catalogs()
            for catalog_record in catalog_records:
                if catalog_record.get('name') == catalog_name:
                    cls._logger.debug('Sharing catalog ' + catalog_name + ' to'
                                      ' all members of org ' + org.get_name())
                    org.share_catalog_with_org_members(
                        catalog_name=catalog_name)
                    return
            raise EntityNotFoundException('Catalog ' + catalog_name +
                                          'doesn\'t exist.')
        finally:
            catalog_author_client.logout()
开发者ID:vmware,项目名称:pyvcloud,代码行数:31,代码来源:environment.py

示例2: acl_share

# 需要导入模块: from pyvcloud.vcd.org import Org [as 别名]
# 或者: from pyvcloud.vcd.org.Org import share_catalog_with_org_members [as 别名]
def acl_share(ctx, catalog_name, access_level):
    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)

        org.share_catalog_with_org_members(
            catalog_name=catalog_name, everyone_access_level=access_level)
        stdout('Catalog shared to all members of the org \'%s\'.' %
               ctx.obj['profiles'].get('org_in_use'), ctx)
    except Exception as e:
        stderr(e, ctx)
开发者ID:vmware,项目名称:vca-cli,代码行数:15,代码来源:catalog.py

示例3: test_08_catalog_share_access

# 需要导入模块: from pyvcloud.vcd.org import Org [as 别名]
# 或者: from pyvcloud.vcd.org.Org import share_catalog_with_org_members [as 别名]
 def test_08_catalog_share_access(self):
     org_in_use = self.client.get_org_by_name(
         self.config['vcd']['org_in_use'])
     org = Org(self.client, resource=org_in_use)
     control_access = org.share_catalog_with_org_members(
         self.config['vcd']['catalog'],
         everyone_access_level='ReadOnly')
     assert control_access.IsSharedToEveryone.text == 'true'
     assert control_access.EveryoneAccessLevel.text == 'ReadOnly'
开发者ID:rdbwebster,项目名称:pyvcloud,代码行数:11,代码来源:vcd_catalog.py


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