Ejemplo n.º 1
0
@click.pass_context
@click.argument('task_id', metavar='<id>', required=True)
def info(ctx, task_id):
    try:
        client = ctx.obj['client']
        result = client.get_resource('%s/task/%s' % (client._uri, task_id))
        stdout(task_to_dict(result), ctx, show_id=True)
    except Exception as e:
        stderr(e, ctx)


@task.command('list', short_help='list tasks')
@click.pass_context
@click.argument('status',
                type=click.Choice(TaskStatus._enums.keys()),
                metavar=as_metavar(TaskStatus._enums.keys()),
                required=False,
                nargs=-1)
def list_tasks(ctx, status):
    try:
        client = ctx.obj['client']
        task_obj = Task(client)
        records = task_obj.list_tasks(filter_status_list=status)
        result = []
        for r in records:
            result.append(
                to_dict(r,
                        attributes=[
                            'name', 'status', 'objectName', 'ownerName',
                            'orgName', 'startDate', 'serviceNamespace', 'id'
                        ]))
Ejemplo n.º 2
0
def info(ctx, task_id):
    try:
        restore_session(ctx)
        client = ctx.obj['client']
        result = client.get_resource('%s/task/%s' % (client._uri, task_id))
        stdout(task_to_dict(result), ctx, show_id=True)
    except Exception as e:
        stderr(e, ctx)


@task.command('list', short_help='list tasks')
@click.pass_context
@click.argument(
    'status',
    type=click.Choice(list(TaskStatus.__members__.keys())),
    metavar=as_metavar(list(TaskStatus.__members__.keys())),
    required=False,
    nargs=-1)
def list_tasks(ctx, status):
    try:
        restore_session(ctx)
        client = ctx.obj['client']
        task_obj = Task(client)
        records = task_obj.list_tasks(filter_status_list=status)
        result = []
        for r in records:
            result.append(
                to_dict(
                    r,
                    attributes=[
                        'name', 'status', 'objectName', 'ownerName', 'orgName',
Ejemplo n.º 3
0
                metavar='organization')
@click.argument('user',
                metavar='user')
@click.option('-p',
              '--password',
              prompt=False,
              metavar='<password>',
              confirmation_prompt=False,
              envvar='VCD_PASSWORD',
              hide_input=True,
              help='Password')
@click.option('-V',
              '--version',
              'api_version',
              required=False,
              metavar=as_metavar(API_CURRENT_VERSIONS),
              type=click.Choice(API_CURRENT_VERSIONS),
              help='API version')
@click.option('-s/-i',
              '--verify-ssl-certs/--no-verify-ssl-certs',
              required=False,
              default=True,
              help='Verify SSL certificates')
@click.option('-w',
              '--disable-warnings',
              is_flag=True,
              required=False,
              default=False,
              help='Do not display warnings when not verifying SSL ' +
                   'certificates')
@click.option('-v',
Ejemplo n.º 4
0
@click.argument('user', metavar='user')
@click.option(
    '-p',
    '--password',
    prompt=False,
    metavar='<password>',
    confirmation_prompt=False,
    envvar='VCD_PASSWORD',
    hide_input=True,
    help='Password')
@click.option(
    '-V',
    '--version',
    'api_version',
    required=False,
    metavar=as_metavar(API_CURRENT_VERSIONS),
    help='API version')
@click.option(
    '-s/-i',
    '--verify-ssl-certs/--no-verify-ssl-certs',
    required=False,
    default=True,
    help='Verify SSL certificates')
@click.option(
    '-w',
    '--disable-warnings',
    is_flag=True,
    required=False,
    default=False,
    help='Do not display warnings when not verifying SSL ' + 'certificates')
@click.option(