Пример #1
0
def list_acl(ctx, catalog_name):
    try:
        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,
               sort_headers=False)
    except Exception as e:
        stderr(e, ctx)
Пример #2
0
def list_acl(ctx, vapp_name):
    try:
        restore_session(ctx, vdc_required=True)
        client = ctx.obj['client']
        vdc_href = ctx.obj['profiles'].get('vdc_href')
        vdc = VDC(client, href=vdc_href)
        vapp = VApp(client, resource=vdc.get_vapp(vapp_name))

        acl = vapp.get_access_settings()
        stdout(
            access_settings_to_list(
                acl, ctx.obj['profiles'].get('org_in_use')), ctx)
    except Exception as e:
        stderr(e, ctx)
Пример #3
0
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)
Пример #4
0
def list_acl(ctx, vapp_name):
    try:
        restore_session(ctx, vdc_required=True)
        client = ctx.obj['client']
        vdc_href = ctx.obj['profiles'].get('vdc_href')
        vdc = VDC(client, href=vdc_href)
        vapp = VApp(client, resource=vdc.get_vapp(vapp_name))

        acl = vapp.get_access_settings()
        stdout(
            access_settings_to_list(
                acl, ctx.obj['profiles'].get('org_in_use')), ctx)
    except Exception as e:
        stderr(e, ctx)
Пример #5
0
def list_acl(ctx, vapp_name):
    try:
        client = ctx.obj['client']
        vdc_href = ctx.obj['profiles'].get('vdc_href')
        vdc = VDC(client, href=vdc_href)
        vapp = VApp(client, resource=vdc.get_vapp(vapp_name))

        acl = vapp.get_access_settings()
        stdout(
            access_settings_to_list(acl,
                                    ctx.obj['profiles'].get('org_in_use')),
            ctx,
            sort_headers=False)
    except Exception as e:
        stderr(e, ctx)
Пример #6
0
def list_acl(ctx, vdc_name):
    try:
        client = ctx.obj['client']
        in_use_org_href = ctx.obj['profiles'].get('org_href')
        org = Org(client, in_use_org_href)
        vdc_resource = org.get_vdc(vdc_name)
        vdc = VDC(client, resource=vdc_resource)

        acl = vdc.get_access_settings()
        stdout(access_settings_to_list(acl,
                                       ctx.obj['profiles'].get('org_in_use')),
               ctx,
               sort_headers=False)
    except Exception as e:
        stderr(e, ctx)
Пример #7
0
def share(ctx, catalog_name, access_level):
    try:
        client = ctx.obj['client']
        in_use_org_href = ctx.obj['profiles'].get('org_href')
        org = Org(client, in_use_org_href)

        updated_acl = org.share_catalog_access(
            catalog_name=catalog_name, everyone_access_level=access_level)
        stdout(
            access_settings_to_list(
                updated_acl, ctx.obj['profiles'].get('org_in_use')),
            ctx,
            sort_headers=False)
    except Exception as e:
        stderr(e, ctx)
Пример #8
0
def list_acl(ctx, vdc_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)
        vdc_resource = org.get_vdc(vdc_name)
        vdc = VDC(client, resource=vdc_resource)

        acl = vdc.get_access_settings()
        stdout(
            access_settings_to_list(acl,
                                    ctx.obj['profiles'].get('org_in_use')),
            ctx)
    except Exception as e:
        stderr(e, ctx)
Пример #9
0
def add(ctx, catalog_name, access_list):
    try:
        client = ctx.obj['client']
        in_use_org_href = ctx.obj['profiles'].get('org_href')
        org = Org(client, in_use_org_href)

        updated_acl = org.add_catalog_access_settings(
            catalog_name=catalog_name,
            access_settings_list=acl_str_to_list_of_dict(access_list))
        stdout(
            access_settings_to_list(
                updated_acl, ctx.obj['profiles'].get('org_in_use')),
            ctx,
            sort_headers=False)
    except Exception as e:
        stderr(e, ctx)
Пример #10
0
def remove(ctx, catalog_name, access_list, all):
    try:
        client = ctx.obj['client']
        in_use_org_href = ctx.obj['profiles'].get('org_href')
        org = Org(client, in_use_org_href)

        if all:
            click.confirm(
                'Do you want to remove all access settings from the catalog '
                '\'%s\'' % catalog_name,
                abort=True)
        updated_acl = org.remove_catalog_access_settings(
            catalog_name=catalog_name,
            access_settings_list=acl_str_to_list_of_dict(access_list),
            remove_all=all)
        stdout(
            access_settings_to_list(
                updated_acl, ctx.obj['profiles'].get('org_in_use')),
            ctx,
            sort_headers=False)
    except Exception as e:
        stderr(e, ctx)