From 77e5404afeea308902f28f15959654e34e20e8ad Mon Sep 17 00:00:00 2001 From: Dolph Mathews Date: Thu, 21 Jul 2011 10:55:26 -0500 Subject: Assigned Base API classes so downstream code knows what to expect --- keystone/backends/api.py | 71 +++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/keystone/backends/api.py b/keystone/backends/api.py index 34bf3b21..1814fae5 100755 --- a/keystone/backends/api.py +++ b/keystone/backends/api.py @@ -12,43 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. - -#API -#TODO(Yogi) Refactor all API to separate classes specific to models. -endpoint_template = None -group = None -role = None -tenant_group = None -tenant = None -token = None -user = None - - -# Function to dynamically set module references. -def set_value(variable_name, value): - if variable_name == 'endpoint_template': - global endpoint_template - endpoint_template = value - elif variable_name == 'group': - global group - group = value - elif variable_name == 'role': - global role - role = value - elif variable_name == 'tenant_group': - global tenant_group - tenant_group = value - elif variable_name == 'tenant': - global tenant - tenant = value - elif variable_name == 'token': - global token - token = value - elif variable_name == 'user': - global user - user = value - - #Base APIs class BaseUserAPI(object): def get_all(self): @@ -306,3 +269,37 @@ class BaseEndpointTemplateAPI(object): def endpoint_delete(self, id): raise NotImplementedError + +#API +#TODO(Yogi) Refactor all API to separate classes specific to models. +endpoint_template = BaseEndpointTemplateAPI() +group = BaseGroupAPI() +role = BaseRoleAPI() +tenant_group = BaseTenantGroupAPI() +tenant = BaseTenantAPI() +token = BaseTokenAPI() +user = BaseUserAPI() + +# Function to dynamically set module references. +def set_value(variable_name, value): + if variable_name == 'endpoint_template': + global endpoint_template + endpoint_template = value + elif variable_name == 'group': + global group + group = value + elif variable_name == 'role': + global role + role = value + elif variable_name == 'tenant_group': + global tenant_group + tenant_group = value + elif variable_name == 'tenant': + global tenant + tenant = value + elif variable_name == 'token': + global token + token = value + elif variable_name == 'user': + global user + user = value -- cgit