예제 #1
0
파일: vdc.py 프로젝트: eulerjiang/pyvcloud
    def get_access_control_settings(self):
        """Get the access control settings of the vdc.

        :return: (dict): Access control settings of the vdc.
        """
        vdc_resource = self.get_resource()
        access_control_settings = self.client.get_linked_resource(
            vdc_resource, RelationType.DOWN,
            EntityType.CONTROL_ACCESS_PARAMS.value)
        return access_control_settings_to_dict(access_control_settings)
예제 #2
0
 def get_catalog_access_control_settings(self, catalog_name):
     """
     Get the access control settings of a catalog.
     :param catalog_name: (str): The name of the catalog.
     :return: (dict): Access control settings of the catalog.
     """  # NOQA
     catalog_resource = self.get_catalog(name=catalog_name)
     access_control_settings = self.client.get_linked_resource(
         catalog_resource, RelationType.DOWN,
         EntityType.CONTROL_ACCESS_PARAMS.value)
     return access_control_settings_to_dict(access_control_settings)
예제 #3
0
파일: catalog.py 프로젝트: tjecheva/vcd-cli
def info(ctx, catalog_name, item_name):
    try:
        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)
            access_control_settings = access_control_settings_to_dict(
                org.get_catalog_access_control_settings(catalog_name))
            result.update(access_control_settings)
        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)