예제 #1
0
def to_request(module, requests):
    transform = ComplexList(
        dict(
            path=dict(key=True),
            method=dict(),
            data=dict(type='dict'),
        ), module)
    return transform(to_list(requests))
예제 #2
0
def to_commands(module, commands):
    spec = {
        'command': dict(key=True),
        'prompt': dict(),
        'answer': dict()
    }
    transform = ComplexList(spec, module)
    return transform(commands)
예제 #3
0
def to_command(module, commands):
    transform = ComplexList(
        dict(
            command=dict(key=True),
            output=dict(default='text'),
            prompt=dict(type='list'),
            answer=dict(type='list'),
            sendonly=dict(type='bool', default=False),
            check_all=dict(type='bool', default=False),
        ), module)
    return transform(to_list(commands))
예제 #4
0
def to_command(module, commands):
    default_output = 'text'
    transform = ComplexList(
        dict(command=dict(key=True),
             output=dict(default=default_output),
             prompt=dict(),
             answer=dict()), module)

    commands = transform(to_list(commands))

    return commands
예제 #5
0
def to_command(module, commands):
    if is_local_eapi(module):
        default_output = 'json'
    else:
        default_output = 'text'

    transform = ComplexList(dict(
        command=dict(key=True),
        output=dict(default=default_output),
        prompt=dict(type='list'),
        answer=dict(type='list'),
        newline=dict(type='bool', default=True),
        sendonly=dict(type='bool', default=False),
        check_all=dict(type='bool', default=False),
    ), module)

    return transform(to_list(commands))