Пример #1
0
def do_sticky_create(cl, args):
    """
    Create a new sticky command
    """
    sticky = cl.stickies.create(args.lb_id, args.name, args.type,
                                **extra_args(args.extra))
    utils.print_dict(sticky._info)
Пример #2
0
def do_probe_create(cl, args):
    """
    Create a new probe
    """
    probe = cl.probes.create(args.lb_id, args.name, args.type,
                             **extra_args(args.extra))
    utils.print_dict(probe._info)
Пример #3
0
def do_lb_create(cl, args):
    """
    Create a new load balancer
    """
    lb = cl.loadbalancers.create(args.name, args.algorithm, args.protocol,
                                 **extra_args(args.extra))
    utils.print_dict(lb.get_info())
Пример #4
0
def do_node_update(cl, args):
    """
    Update a specific node
    """
    kwargs = extra_args(args.extra)
    if args.name:
        kwargs['name'] = args.name
    if args.type:
        kwargs['type'] = args.type
    if args.address:
        kwargs['address'] = args.address
    if args.port:
        kwargs['port'] = args.port
    if args.weight:
        kwargs['weight'] = args.weight
    if args.condition:
        kwargs['condition'] = args.condition

    if not len(kwargs):
        print "Node not updated, no arguments present."
        return

    try:
        node = cl.nodes.update(args.lb_id, args.id, **kwargs)
        print 'Node has been updated.'
        utils.print_dict(node._info)
    except Exception, e:
        print 'Unable to update node: %s' % e
        raise
Пример #5
0
def do_node_update(cl, args):
    """
    Update a specific node
    """
    kwargs = extra_args(args.extra)
    if args.name:
        kwargs['name'] = args.name
    if args.type:
        kwargs['type'] = args.type
    if args.address:
        kwargs['address'] = args.address
    if args.port:
        kwargs['port'] = args.port
    if args.weight:
        kwargs['weight'] = args.weight
    if args.condition:
        kwargs['condition'] = args.condition

    if not len(kwargs):
        print "Node not updated, no arguments present."
        return

    try:
        node = cl.nodes.update(args.lb_id, args.id, **kwargs)
        print 'Node has been updated.'
        utils.print_dict(node._info)
    except Exception, e:
        print 'Unable to update node: %s' % e
        raise
Пример #6
0
def do_probe_create(cl, args):
    """
    Create a new probe
    """
    probe = cl.probes.create(args.lb_id, args.name, args.type,
                             **extra_args(args.extra))
    utils.print_dict(probe._info)
Пример #7
0
def do_sticky_create(cl, args):
    """
    Create a new sticky command
    """
    sticky = cl.stickies.create(args.lb_id, args.name, args.type,
                                **extra_args(args.extra))
    utils.print_dict(sticky._info)
Пример #8
0
def do_lb_create(cl, args):
    """
    Create a new load balancer
    """
    lb = cl.loadbalancers.create(args.name, args.algorithm, args.protocol,
                                 **extra_args(args.extra))
    utils.print_dict(lb.get_info())
Пример #9
0
def do_node_create(cl, args):
    """
    Create a new node
    """
    node = cl.nodes.create(args.lb_id, args.name, args.type, args.address,
                           args.port, args.weight, args.condition,
                           **extra_args(args.extra))
    utils.print_dict(node._info)
Пример #10
0
def do_device_create(cl, args):
    """
    Create a new load-balancing device
    """
    device = cl.devices.create(args.name, args.type, args.version, args.ip,
                               args.port, args.user, args.password,
                               **extra_args(args.extra))
    utils.print_dict(device._info)
Пример #11
0
def do_vip_create(cl, args):
    """
    Create a new virtual IP
    """
    vip = cl.vips.create(args.lb_id, args.name, args.address, args.mask,
                         args.port, type=args.type, vlan=args.vlan,
                         **extra_args(args.extra))
    utils.print_dict(vip._info)
Пример #12
0
def do_node_create(cl, args):
    """
    Create a new node
    """
    node = cl.nodes.create(args.lb_id, args.name, args.type, args.address,
                           args.port, args.weight, args.condition,
                           **extra_args(args.extra))
    utils.print_dict(node._info)
Пример #13
0
def do_device_create(cl, args):
    """
    Create a new load-balancing device
    """
    device = cl.devices.create(args.name, args.type, args.version, args.ip,
                               args.port, args.user, args.password,
                               **extra_args(args.extra))
    utils.print_dict(device._info)
Пример #14
0
def do_vip_create(cl, args):
    """
    Create a new virtual IP
    """
    vip = cl.vips.create(args.lb_id,
                         args.name,
                         args.address,
                         args.mask,
                         args.port,
                         type=args.type,
                         vlan=args.vlan,
                         **extra_args(args.extra))
    utils.print_dict(vip._info)
Пример #15
0
def do_lb_update(cl, args):
    """
    Update a specific load balancer
    """
    kwargs = extra_args(args.extra)
    if args.name:
        kwargs['name'] = args.name
    if args.algorithm:
        kwargs['algorithm'] = args.algorithm
    if args.protocol:
        kwargs['protocol'] = args.protocol

    if not len(kwargs):
        print "LoadBalancer not updated, no arguments present."
        return

    try:
        lb = cl.loadbalancers.update(args.id, **kwargs)
        print 'LoadBalancer has been updated.'
        utils.print_dict(lb._info)
    except Exception, e:
        print 'Unable to update loadbalancer: %s' % e
        raise
Пример #16
0
def do_lb_update(cl, args):
    """
    Update a specific load balancer
    """
    kwargs = extra_args(args.extra)
    if args.name:
        kwargs['name'] = args.name
    if args.algorithm:
        kwargs['algorithm'] = args.algorithm
    if args.protocol:
        kwargs['protocol'] = args.protocol

    if not len(kwargs):
        print "LoadBalancer not updated, no arguments present."
        return

    try:
        lb = cl.loadbalancers.update(args.id, **kwargs)
        print 'LoadBalancer has been updated.'
        utils.print_dict(lb._info)
    except Exception, e:
        print 'Unable to update loadbalancer: %s' % e
        raise
Пример #17
0
def do_vip_show(cl, args):
    """
    Describe a specific virtual IP
    """
    vip = cl.vips.get(args.lb_id, args.id)
    utils.print_dict(vip._info)
Пример #18
0
def do_sticky_show(cl, args):
    """
    Describe a specific sticky command
    """
    sticky = cl.stickies.get(args.lb_id, args.id)
    utils.print_dict(sticky._info)
Пример #19
0
def do_node_show(cl, args):
    """
    Describe a specific node
    """
    node = cl.nodes.get(args.lb_id, args.id)
    utils.print_dict(node._info)
Пример #20
0
def do_probe_show(cl, args):
    """
    Describe a specific probe
    """
    probe = cl.probes.get(args.lb_id, args.id)
    utils.print_dict(probe._info)
Пример #21
0
def do_probe_show(cl, args):
    """
    Describe a specific probe
    """
    probe = cl.probes.get(args.lb_id, args.id)
    utils.print_dict(probe._info)
Пример #22
0
def do_node_show(cl, args):
    """
    Describe a specific node
    """
    node = cl.nodes.get(args.lb_id, args.id)
    utils.print_dict(node._info)
Пример #23
0
def do_sticky_show(cl, args):
    """
    Describe a specific sticky command
    """
    sticky = cl.stickies.get(args.lb_id, args.id)
    utils.print_dict(sticky._info)
Пример #24
0
def do_device_show(cl, args):
    """
    Describe a specific load-balancing device
    """
    device = cl.devices.get(args.id)
    utils.print_dict(device._info)
Пример #25
0
def do_device_show(cl, args):
    """
    Describe a specific load-balancing device
    """
    device = cl.devices.get(args.id)
    utils.print_dict(device._info)
Пример #26
0
def do_vip_show(cl, args):
    """
    Describe a specific virtual IP
    """
    vip = cl.vips.get(args.lb_id, args.id)
    utils.print_dict(vip._info)
Пример #27
0
def do_lb_show(cl, args):
    """
    Describe a specific load balancer
    """
    lb = cl.loadbalancers.get(args.id)
    utils.print_dict(lb.get_info())
Пример #28
0
def do_lb_show(cl, args):
    """
    Describe a specific load balancer
    """
    lb = cl.loadbalancers.get(args.id)
    utils.print_dict(lb.get_info())