Commit 3049bc85 authored by Yunhua Koglin's avatar Yunhua Koglin
Browse files

add prefix

parent 7f98457b
......@@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = '2.0.6'
__version__ = '2.0.7'
......@@ -164,10 +164,8 @@ class AwsStorage(BlobStorageBase):
if_not_match=None,
auth: Optional = None, content_type: str = None, metadata: dict = None,
timeout: int = 30, **kwargs) -> Blob:
bucket = tenant.bucket_name
await self.getCredentials(tenant)
bucket = tenant.bucket_name
object_name = f"{bucket}/{object_name}"
s3_client = boto3.client(
's3',
......@@ -215,10 +213,15 @@ class AwsStorage(BlobStorageBase):
async def delete(self, tenant: Tenant, object_name: str,
*, auth: Optional = None, timeout: int = 10, **kwargs):
encoded_object_name = quote(object_name, safe='')
bucket = tenant.bucket_name
await self.getCredentials(tenant)
bucket = tenant.bucket_name
object_name = f"{bucket}/{object_name}"
encoded_object_name = quote(object_name, safe='')
print("delete: object_name \n\n")
print(object_name)
s3_client = boto3.client(
's3',
region_name=self._region,
......@@ -292,14 +295,20 @@ class AwsStorage(BlobStorageBase):
max_result: Optional[int] = None, timeout: int = 10, **kwargs) -> List[str]:
await self.getCredentials(tenant)
bucket = tenant.bucket_name
prefix_name = f"{bucket}/"
kwargs = {'Bucket': self._bucket_name}
if prefix is not None:
kwargs['Prefix'] = prefix
prefix_name = prefix_name+prefix
if max_result is not None:
kwargs['MaxKeys'] = max_result
kwargs['Prefix'] = prefix_name
print("list_objects, prefix is \n\n")
print(prefix)
s3_client = boto3.client(
's3',
region_name=self._region,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment