예제 #1
0
def add(ctx, vapp_name, access_list):
    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))

        vapp.add_access_settings(
            access_settings_list=acl_str_to_list_of_dict(access_list))
        stdout('Access settings added to vapp \'%s\'.' % vapp_name, ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #2
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)

        org.add_catalog_access_settings(
            catalog_name=catalog_name,
            access_settings_list=acl_str_to_list_of_dict(access_list))
        stdout('Access settings added to catalog \'%s\'.' % catalog_name, ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #3
0
파일: catalog.py 프로젝트: vmware/vca-cli
def add(ctx, catalog_name, access_list):
    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.add_catalog_access_settings(
            catalog_name=catalog_name,
            access_settings_list=acl_str_to_list_of_dict(access_list))
        stdout('Access settings added to catalog \'%s\'.' % catalog_name, ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #4
0
파일: vdc.py 프로젝트: rdbwebster/vcd-cli
def add(ctx, vdc_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)
        vdc_resource = org.get_vdc(vdc_name)
        vdc = VDC(client, resource=vdc_resource)

        vdc.add_access_settings(
            access_settings_list=acl_str_to_list_of_dict(access_list))
        stdout('Access settings added to vdc \'%s\'.' % vdc_name, ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #5
0
파일: vapp.py 프로젝트: vmware/vca-cli
def add(ctx, vapp_name, access_list):
    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))

        vapp.add_access_settings(
            access_settings_list=acl_str_to_list_of_dict(access_list))
        stdout('Access settings added to vapp \'%s\'.' % vapp_name, ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #6
0
파일: vdc.py 프로젝트: vmware/vca-cli
def add(ctx, vdc_name, access_list):
    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)

        vdc.add_access_settings(
            access_settings_list=acl_str_to_list_of_dict(access_list))
        stdout('Access settings added to vdc \'%s\'.' % vdc_name, ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #7
0
파일: catalog.py 프로젝트: tjecheva/vcd-cli
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)
예제 #8
0
def remove(ctx, vapp_name, access_list, all):
    try:
        if all:
            click.confirm(
                'Do you want to remove all access settings from the vapp '
                '\'%s\'' % vapp_name,
                abort=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))

        vapp.remove_access_settings(
            access_settings_list=acl_str_to_list_of_dict(access_list),
            remove_all=all)
        stdout('Access settings removed from vapp \'%s\'.' % vapp_name, ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #9
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)
        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 removed from catalog \'%s\'.' % catalog_name,
               ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #10
0
파일: vapp.py 프로젝트: vmware/vca-cli
def remove(ctx, vapp_name, access_list, all):
    try:
        if all:
            click.confirm(
                'Do you want to remove all access settings from the vapp '
                '\'%s\'' % vapp_name,
                abort=True)
        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))

        vapp.remove_access_settings(
            access_settings_list=acl_str_to_list_of_dict(access_list),
            remove_all=all)
        stdout('Access settings removed from vapp \'%s\'.' % vapp_name, ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #11
0
파일: catalog.py 프로젝트: vmware/vca-cli
def remove(ctx, catalog_name, access_list, all):
    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 all:
            click.confirm(
                'Do you want to remove all access settings from the catalog '
                '\'%s\'' % catalog_name,
                abort=True)
        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 removed from catalog \'%s\'.' % catalog_name,
               ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #12
0
파일: vdc.py 프로젝트: rdbwebster/vcd-cli
def remove(ctx, vdc_name, access_list, all):
    try:
        client = ctx.obj['client']
        in_use_org_href = ctx.obj['profiles'].get('org_href')

        if all:
            click.confirm(
                'Do you want to remove all access settings from the vdc '
                '\'%s\'' % vdc_name,
                abort=True)

        org = Org(client, in_use_org_href)
        vdc_resource = org.get_vdc(vdc_name)
        vdc = VDC(client, resource=vdc_resource)

        vdc.remove_access_settings(
            access_settings_list=acl_str_to_list_of_dict(access_list),
            remove_all=all)
        stdout('Access settings removed from vdc \'%s\'.' % vdc_name, ctx)
    except Exception as e:
        stderr(e, ctx)
예제 #13
0
파일: vdc.py 프로젝트: vmware/vca-cli
def remove(ctx, vdc_name, access_list, all):
    try:
        restore_session(ctx)
        client = ctx.obj['client']
        in_use_org_href = ctx.obj['profiles'].get('org_href')

        if all:
            click.confirm(
                'Do you want to remove all access settings from the vdc '
                '\'%s\'' % vdc_name,
                abort=True)

        org = Org(client, in_use_org_href)
        vdc_resource = org.get_vdc(vdc_name)
        vdc = VDC(client, resource=vdc_resource)

        vdc.remove_access_settings(
            access_settings_list=acl_str_to_list_of_dict(access_list),
            remove_all=all)
        stdout('Access settings removed from vdc \'%s\'.' % vdc_name, ctx)
    except Exception as e:
        stderr(e, ctx)