def __init__(self, main_shell): base_shell.__init__(self) self.main_shell = main_shell if main_shell.is_uk: self.auth_url = uk_authurl_v1_0 else: self.auth_url = us_authurl_v1_0 with error_handler(self, '(auth)'): self.api = novaclient.v1_0.client.Client(main_shell.username, main_shell.apikey, None, self.auth_url) # prevent client from trying to auth, since we've already done so # _cs_request only auths if management_url is None self.api.management_url = main_shell.server_url self.api.auth_token = main_shell.auth_token self.set_prompt(main_shell.username, ['Servers']) self.servers = None self.images = None self.limits = None with error_handler(self, '(flavors)'): self.flavors = self.api.flavors.list() self.strip_refresh = re.compile('\brefresh\b')
def __init__(self, lb_shell, lb): base_shell.__init__(self) self.lb_shell = lb_shell self.set_prompt(self.lb_shell.main_shell.username, ['Load Balancer', self.lb_shell.region, lb.name]) self.lb = lb self.intro = color.set('yellow') + "If you make any updates, they are" + \ " not finalized until you run update or commit" + color.clear()
def __init__(self, username, apikey, is_uk=False, snet=False, auth_version="1.0"): base_shell.__init__(self) self.username = username self.apikey = apikey self.is_uk = is_uk self.snet = snet self.auth_version = auth_version self.do_auth("")
def __init__(self, main_shell, region): base_shell.__init__(self) self.main_shell = main_shell self.api = cloudlb.CloudLoadBalancer(username=main_shell.username, api_key=main_shell.apikey, region=region) # prevent client from trying to auth, since we've already done so # _cloudlb_request only auths if management_url is None self.api.auth_token = main_shell.auth_token self.account_number = main_shell.server_url.split("/")[-1] self.region_account_url = "%s/%s" % (cloudlb.consts.REGION_URL % region, self.account_number) self.set_prompt(main_shell.username, ['Load Balancer', region]) self.region = region self.lbs = None self.lb = None self.algorithms = self.api.get_algorithms() self.protocols = self.api.get_protocols()