Commit 479e93a7 authored by Yunhua Koglin's avatar Yunhua Koglin
Browse files

update

parent fbab175d
......@@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = '2.0.1'
__version__ = '2.0.2'
......@@ -154,8 +154,12 @@ class AwsStorage(BlobStorageBase):
self._session_token = credentials['SessionToken']
async def upload(self, tenant: Tenant, object_name: str, file_data: Any, *,
overwrite: bool = True,
if_match=None,
if_not_match=None,
auth: Optional = None, content_type: str = None, metadata: dict = None,
timeout: int = 30, **kwargs):
timeout: int = 30, **kwargs) -> Blob:
bucket = tenant.bucket_name
await self.getCredentials(tenant)
......@@ -168,6 +172,9 @@ class AwsStorage(BlobStorageBase):
aws_session_token=self._session_token
)
stream_data = self._preprocess_data(file_data)
if if_match or if_not_match:
extra['etag'] = if_match or if_not_match
extra: dict = {}
if(content_type != None):
extra['ContentType'] = content_type
......@@ -180,7 +187,22 @@ class AwsStorage(BlobStorageBase):
response = s3_client.upload_fileobj(stream_data, self._bucket_name,object_name)
else:
response = s3_client.upload_fileobj(stream_data, self._bucket_name, object_name,ExtraArgs=extra)
return response
print("\nresponse:\n")
print(response)
print("end of response\n\n")
return Blob(identifier=object_name,
bucket=tenant.bucket_name,
name=response.get('name', object_name),
metadata=response.get('metadata', {}),
acl=response.get('acl', None),
content_type=content_type,
time_created=str(response.get('date', '')),
time_updated=str(response.get('last_modified', '')),
size=response.get('size', -1),
etag=response.get('etag', None),
provider_specific=response)
# return response
async def delete(self, tenant: Tenant, object_name: str,
*, auth: Optional = None, timeout: int = 10, **kwargs):
......
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