Преглед на файлове

Added missing methods to Object Store interface

Nuwan Goonasekera преди 10 години
родител
ревизия
9ea5e49580
променени са 3 файла, в които са добавени 21 реда и са изтрити 5 реда
  1. 10 0
      cloudbridge/cloud/interfaces/resources.py
  2. 5 2
      cloudbridge/cloud/providers/aws/resources.py
  3. 6 3
      test/test_object_store_service.py

+ 10 - 0
cloudbridge/cloud/interfaces/resources.py

@@ -1865,3 +1865,13 @@ class Bucket(PageableObjectMixin, CloudResource):
         :return: ``True`` if successful.
         :return: ``True`` if successful.
         """
         """
         pass
         pass
+
+    @abstractmethod
+    def create_object(self, name):
+        """
+        Creates a new object within this bucket.
+
+        :rtype: :class:``.BucketObject``
+        :return: The newly created bucket object
+        """
+        pass

+ 5 - 2
cloudbridge/cloud/providers/aws/resources.py

@@ -748,8 +748,11 @@ class AWSBucket(BaseBucket):
         """
         """
         Retrieve a given object from this bucket.
         Retrieve a given object from this bucket.
         """
         """
-        raise NotImplementedError(
-            'Bucket.list not implemented by this provider')
+        key = self._bucket.get_key(key)
+        if key:
+            return AWSBucketObject(self._provider, key)
+        else:
+            return None
 
 
     def list(self, limit=None, marker=None):
     def list(self, limit=None, marker=None):
         """
         """

+ 6 - 3
test/test_object_store_service.py

@@ -104,10 +104,13 @@ class CloudObjectStoreServiceTestCase(ProviderTestBase):
                     "List bucket objects does not return the expected"
                     "List bucket objects does not return the expected"
                     " object %s" % obj_name)
                     " object %s" % obj_name)
 
 
+                get_bucket_obj = test_bucket.get(obj_name)
                 self.assertTrue(
                 self.assertTrue(
-                    found_objs[0] == obj,
-                    "Objects returned by list: {0} are not as "
-                    " expected: {1}" .format(found_objs[0].id,
+                    found_objs[0] ==
+                    get_bucket_obj == obj,
+                    "Objects returned by list: {0} and get: {1} are not as "
+                    " expected: {2}" .format(found_objs[0].id,
+                                             get_bucket_obj.id,
                                              obj.id))
                                              obj.id))
 
 
             objs = test_bucket.list()
             objs = test_bucket.list()