blob: ee55f73c4f6d304d2d8de2d979688453cba4c2b6 [file] [log] [blame]
Tony Mackaae0bf02013-04-09 09:43:50 -04001from plstackapi.openstack.client import OpenStackClient
2from plstackapi.openstack.driver import OpenStackDriver
Tony Mackf1c12242013-04-09 16:08:43 -04003from plstackapi.core.api.auth import auth_check
4from plstackapi.core.models import Flavor
Tony Mackaae0bf02013-04-09 09:43:50 -04005
Tony Mack29c287f2013-04-11 21:07:16 -04006def _get_flavors(filter):
7 if isinstance(filter, int):
8 flavors = Flavor.objects.filter(id=filter)
9 elif isinstance(filter, StringTypes):
10 flavors = Flavor.objects.filter(name=filter)
11 elif isinstance(filer, dict):
12 flavors = Flavor.objects.filter(**filter)
13 else:
14 flavors = []
15 return flavors
Tony Mackaae0bf02013-04-09 09:43:50 -040016
17def add_flavor(auth, fields={}):
18 """not implemented"""
19 return
20
21def delete_flavor(auth, filter={}):
22 """not implemented"""
23 return 1
24
25def get_flavors(auth, filter={}):
26 auth_check(auth)
Tony Mack29c287f2013-04-11 21:07:16 -040027 flavors = _get_flavors(filter)
Tony Mackaae0bf02013-04-09 09:43:50 -040028 return flavors
29
30
31