clb.py
696 Bytes
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# author tiexin.yang@yoho.cn
import os
import sys
import json
import argparse
from switch_lb import LBSwitch
class clb_handler():
def __init__(self, secretId, secretKey, az1_lb_id, az2_lb_id, az3_lb_id, az1_innerlb_id, zone):
self.zone = zone
self.clbClient = LBSwitch(secretId, secretKey, az1_lb_id, az2_lb_id, az3_lb_id, az1_innerlb_id)
def start(self):
if self.zone == 'zone1':
ret = self.clbClient.all_to_az1()
elif self.zone == 'zone2':
ret = self.clbClient.all_to_az2()
else:
print 'Zone name {0} can not be recongnized'.format(self.zone)
return True