libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r894766 - in /incubator/libcloud/trunk/libcloud: base.py interface.py
Date Thu, 31 Dec 2009 02:31:26 GMT
Author: pquerna
Date: Thu Dec 31 02:31:26 2009
New Revision: 894766

URL: http://svn.apache.org/viewvc?rev=894766&view=rev
Log:
add NodeOptions interface + base classes to better repersent node creation

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=894766&r1=894765&r2=894766&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/base.py (original)
+++ incubator/libcloud/trunk/libcloud/base.py Thu Dec 31 02:31:26 2009
@@ -22,6 +22,7 @@
 from libcloud.interface import INodeFactory, INode
 from libcloud.interface import INodeSizeFactory, INodeSize
 from libcloud.interface import INodeImageFactory, INodeImage
+from libcloud.interface import INodeOptionsFactory, INodeOptions
 import hashlib
 from pipes import quote as pquote
 
@@ -101,7 +102,6 @@
         return (('<NodeImage: id=%s, name=%s, driver=%s  ...>')
                 % (self.id, self.name, self.driver.name))
 
-
 class NodeLocation(object):
     """
     A base NodeLocation class to derive from.
@@ -117,6 +117,21 @@
         return (('<NodeLocation: id=%s, name=%s, country=%s, driver=%s>')
                 % (self.id, self.name, self.country, self.driver.name))
 
+class NodeOptions(object):
+    """
+    A base NodeLocation class to derive from.
+    """
+    interface.implements(INodeOptions)
+    interface.classProvides(INodeOptionsFactory)
+    def __init__(self, location, image, size, driver):
+        self.location = location
+        self.image = image
+        self.size = size
+        self.driver = driver
+    def __repr__(self):
+        return (('<NodeOptions: location=%s, image=%s, country=%s, driver=%s>')
+                % (self.location, self.image, self.size, self.driver.name))
+
 class Response(object):
     """
     A Base Response class to derive from.
@@ -354,7 +369,7 @@
         self.connection.driver = self
         self.connection.connect()
 
-    def create_node(self, name, image, size, **kwargs):
+    def create_node(self, name, options, **kwargs):
         raise NotImplementedError, 'create_node not implemented for this driver'
 
     def destroy_node(self, node):

Modified: incubator/libcloud/trunk/libcloud/interface.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/interface.py?rev=894766&r1=894765&r2=894766&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/interface.py (original)
+++ incubator/libcloud/trunk/libcloud/interface.py Thu Dec 31 02:31:26 2009
@@ -113,6 +113,20 @@
         Set values for ivars, including any other requisite kwargs
         """
 
+class INodeOptions(Interface):
+    driver = Attribute("""The NodeDriver that belongs to these options""")
+    location = Attribute("Location of the node")
+    image = Attribute("Image of the node")
+    size = Attribute("Size of the node")
+
+class INodeOptionsFactory(Interface):
+    """
+    Create nodes location
+    """
+    def __call__(id, location, image, size, driver):
+        """
+        Set values for ivars, including any other requisite kwargs
+        """
 
 class INodeDriverFactory(Interface):
     """



Mime
View raw message