def __init__(self, master=None): Frame.__init__(self, master) config_file = os.path.join(os.path.expanduser('~'), '.vdcapi') if os.path.isfile(config_file): with open(config_file) as fh: data = fh.read() config = json.loads(data) api_url = config['api_url'] apiKey = config['api_key'] secret = config['api_secret'] # Create the api access object self.api = vdc.VDCApiCall(api_url, apiKey, secret) # Options for collecting the cpu data self.plot_interval = 10 self.plot_points = 25 # Create deque object to hold cpu data self.cpuData = deque([],self.plot_points) # INITIALISE THE GUI self.pack() self.createWidgets()
def __init__(self, master=None): Frame.__init__(self, master) config_file = os.path.join(os.path.expanduser('~'), '.vdcapi') if os.path.isfile(config_file): with open(config_file) as fh: data = fh.read() config = json.loads(data) api_url = config['api_url'] apiKey = config['api_key'] secret = config['api_secret'] # Create the api access object self.api = vdc.VDCApiCall(api_url, apiKey, secret) self.plot_interval = 10 self.plot_points = 100 # Create deque object to hold cpu data self.cpuData = deque([], self.plot_points) # Initialise the plot self.fig = mplfig.Figure(figsize=(9, 4), dpi=100) self.a = self.fig.add_subplot(111) self.canvas = FigureCanvasTkAgg(self.fig, master=self) self.plot_update() self.fig.canvas.draw() self.canvas.get_tk_widget().pack(side=TOP, fill=BOTH, expand=1) self.pack() self.createWidgets()
def __init__(self, master=None): Frame.__init__(self, master) config_file = os.path.join(os.path.expanduser('~'), '.vdcapi') if os.path.isfile(config_file): with open(config_file) as fh: data = fh.read() config = json.loads(data) api_url = config['api_url'] apiKey = config['api_key'] secret = config['api_secret'] # Create the api access object self.api = vdc.VDCApiCall(api_url, apiKey, secret) # INITIALISE THE GUI self.pack() self.createWidgets()
def __init__(self, master=None): Frame.__init__(self) config_file = "/home/pi/.vdcapi" print("CONFIG: %s" % (config_file)) if os.path.isfile(config_file): with open(config_file) as fh: #print("READING CONFIG") data = fh.read() config = json.loads(data) api_url = config['api_url'] apiKey = config['api_key'] secret = config['api_secret'] # Create the api access object self.api = vdc.VDCApiCall(api_url, apiKey, secret) # INITIALISE THE GUI self.vmSelectedNumber = 0 self.pack({"fill": "both"}) self.createWidgets()
def create(): cloudinit_scripts_dir = 'cloudinit-scripts' config_file = os.path.join(os.path.expanduser('~'), '.vdcapi') if os.path.isfile(config_file): with open(config_file) as fh: data = fh.read() config = json.loads(data) api_url = config['api_url'] apiKey = config['api_key'] secret = config['api_secret'] try: cloudinit_scripts_dir = config['cloudinit_scripts_dir'] except KeyError: pass else: print('API url (e.g. http://10.220.18.115:8080/client/api):', end='') api_url = raw_input() print('API key:', end='') apiKey = raw_input() secret = getpass.getpass(prompt='API secret:') # Create the api access object api = vdc_api_call.VDCApiCall(api_url, apiKey, secret) return api
data = fh.read() config = json.loads(data) api_url = config['api_url'] apiKey = config['api_key'] secret = config['api_secret'] try: cloudinit_scripts_dir = config['cloudinit_scripts_dir'] except KeyError: pass else: print('API url (e.g. http://10.220.18.115:8080/client/api):', end='') api_url = raw_input() print('API key:', end='') apiKey = raw_input() secret = getpass.getpass(prompt='API secret:') # Create the api access object api = vdc.VDCApiCall(api_url, apiKey, secret) # Define the request #request = {} # Execute the API call #result = api.listZones(request) #print the result #pprint(result) # FOR ASYNCHRONOUS CALLS ONLY #pprint(api.wait_for_job(result['jobid']))