Esempio n. 1
0
    def _make_bucket_list(self, content):
        response_bucket_list = utils.make_select_list(content, 'name')
        bucket_list = list()

        for b in response_bucket_list:
            bucket_list.append(SSGBucket(self, b))

        return bucket_list
Esempio n. 2
0
    def get_location(self):
        """
        Returns the LocationConstraint for the bucket.

        :rtype: str
        :return: The LocationConstraint for the bucket or the empty
            string if no constraint was specified when bucket was created.
        """
        response, content = self.connection.make_request("GET", "buckets", bucket=self.name)
        location = utils.make_select_list(content, 'location')
        return location
Esempio n. 3
0
    def list(self):
        key_list = []
        method = "GET"
        url = "buckets"
        query = '/key_list?path=/'

        response, content = self.connection.make_request(method, url, bucket=self.name, query=query)
        try:
            utils.check_response(response)
            #데이터 형식 확인 후 key_list return
            key_list = utils.make_select_list(content, "path")

        except request_error as re:
            self.connection.request_error_handler(re, 'get_key_list', method, url,
                                                  response, bucket=self.name)
        return key_list
Esempio n. 4
0
    def list(self):
        """
        List keys' name within a bucket.

        this will return a list of available keys' name within the bucket

        :rtype: list
        :return: a list of all available keys' name within the bucket .
        """
        key_list = []
        method = "GET"
        url = "buckets"
        query = '/key_list?path=/'

        response, content = self.connection.make_request(method, url, bucket=self.name, query=query)
        try:
            utils.check_response(response)
            #데이터 형식 확인 후 key_list return
            key_list = utils.make_select_list(content, "path")

        except request_error as re:
            self.connection.request_error_handler(re, 'get_key_list', method, url,
                                                  response, bucket=self.name)
        return key_list
Esempio n. 5
0
 def get_location(self):
     response, content = self.connection.make_request("GET", "buckets", bucket=self.name)
     location = utils.make_select_list(content, 'location')
     return location