21 lines
530 B
Python
21 lines
530 B
Python
import vultron.cmd
|
|
|
|
class Region(vultron.cmd.Command):
|
|
"""Query for information on Vultr regions."""
|
|
|
|
def init(self):
|
|
self.needs_api_key = False
|
|
|
|
def vultron_list(self):
|
|
"""Display all available regions."""
|
|
|
|
regions = self.api.get("regions")
|
|
return regions["regions"]
|
|
|
|
def vultron_plans(self, region_id):
|
|
"""Display available plans for a given region."""
|
|
|
|
plans = self.api.get("regions", region_id, "availability")
|
|
table = [{"plan": plan} for plan in plans["available_plans"]]
|
|
return table
|