You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by pq...@apache.org on 2009/12/31 03:31:02 UTC

svn commit: r894762 - in /incubator/libcloud/trunk/libcloud: base.py interface.py

Author: pquerna
Date: Thu Dec 31 02:31:02 2009
New Revision: 894762

URL: http://svn.apache.org/viewvc?rev=894762&view=rev
Log:
start stubbing out the list location api

Modified:
    incubator/libcloud/trunk/libcloud/base.py
    incubator/libcloud/trunk/libcloud/interface.py

Modified: incubator/libcloud/trunk/libcloud/base.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/base.py?rev=894762&r1=894761&r2=894762&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/base.py (original)
+++ incubator/libcloud/trunk/libcloud/base.py Thu Dec 31 02:31:02 2009
@@ -102,6 +102,20 @@
                 % (self.id, self.name, self.driver.name))
 
 
+class NodeLocation(object):
+    """
+    A base NodeLocation class to derive from.
+    """
+    interface.implements(INodeImage)
+    interface.classProvides(INodeImageFactory)
+    def __init__(self, id, name, country):
+        self.id = id
+        self.name = name
+        self.country = country
+    def __repr__(self):
+        return (('<NodeLocation: id=%s, name=%s, driver=%s>')
+                % (self.id, self.name, self.driver.name))
+
 class Response(object):
     """
     A Base Response class to derive from.
@@ -356,3 +370,6 @@
 
     def list_sizes(self):
         raise NotImplementedError, 'list_sizes not implemented for this driver'
+
+    def list_locations(self):
+        raise NotImplementedError, 'list_locations not implemented for this driver'

Modified: incubator/libcloud/trunk/libcloud/interface.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/interface.py?rev=894762&r1=894761&r2=894762&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/interface.py (original)
+++ incubator/libcloud/trunk/libcloud/interface.py Thu Dec 31 02:31:02 2009
@@ -85,7 +85,6 @@
     driver = Attribute("""The NodeDriver that belongs to this Image""")
     extra = Attribute("""Dict containing provider specific data""")
 
-
 class INodeImageFactory(Interface):
     """
     Create nodes
@@ -95,6 +94,25 @@
         Set values for ivars, including any other requisite kwargs
         """
 
+class INodeLocation(Interface)
+    """
+    Physical Location of a node
+    """
+    id = Attribute("""Unique ID provided by the provider for a physical datacenter""")
+    name = Attribute("""Name provided by the provider ('Austin Texas DC 1')""")
+    country = Attribute("""ISO 3166 country code of the physical location of the data center
+                          <http://www.iso.org/iso/english_country_names_and_code_elements>""")
+    driver = Attribute("""The NodeDriver that belongs to this Location""")
+
+class INodeLocationFactory(Interface):
+    """
+    Create nodes location
+    """
+    def __call__(id, name, country, driver):
+        """
+        Set values for ivars, including any other requisite kwargs
+        """
+
 
 class INodeDriverFactory(Interface):
     """
@@ -145,6 +163,11 @@
         Returns a list of sizes for this provider
         """
 
+    def list_locations():
+        """
+        Returns a list of locations for this prodiver
+        """
+
     def reboot_node(node):
         """
         Returns True if the reboot was successful, otherwise False