Index: boto/provider.py |
diff --git a/boto/provider.py b/boto/provider.py |
index c1c8b59105d77f87409304241e52c4c40e37321e..7e9f640d7cd483428c1d767d3e2c7ed5ae5f1fee 100644 |
--- a/boto/provider.py |
+++ b/boto/provider.py |
@@ -1,6 +1,7 @@ |
# Copyright (c) 2010 Mitch Garnaat http://garnaat.org/ |
# Copyright 2010 Google Inc. |
# Copyright (c) 2010, Eucalyptus Systems, Inc. |
+# Copyright (c) 2011, Nexenta Systems Inc. |
# All rights reserved. |
# |
# Permission is hereby granted, free of charge, to any person obtaining a |
@@ -50,6 +51,7 @@ RESUMABLE_UPLOAD_HEADER_KEY = 'resumable-upload-header' |
SECURITY_TOKEN_HEADER_KEY = 'security-token-header' |
STORAGE_CLASS_HEADER_KEY = 'storage-class' |
MFA_HEADER_KEY = 'mfa-header' |
+SERVER_SIDE_ENCRYPTION_KEY = 'server-side-encryption-header' |
VERSION_ID_HEADER_KEY = 'version-id-header' |
STORAGE_COPY_ERROR = 'StorageCopyError' |
@@ -81,6 +83,14 @@ class Provider(object): |
'google' : 'gs' |
} |
+ ChunkedTransferSupport = { |
+ 'aws' : False, |
+ 'google' : True |
+ } |
+ |
+ # If you update this map please make sure to put "None" for the |
+ # right-hand-side for any headers that don't apply to a provider, rather |
+ # than simply leaving that header out (which would cause KeyErrors). |
HeaderInfoMap = { |
'aws' : { |
HEADER_PREFIX_KEY : AWS_HEADER_PREFIX, |
@@ -96,6 +106,7 @@ class Provider(object): |
'metadata-directive', |
RESUMABLE_UPLOAD_HEADER_KEY : None, |
SECURITY_TOKEN_HEADER_KEY : AWS_HEADER_PREFIX + 'security-token', |
+ SERVER_SIDE_ENCRYPTION_KEY : AWS_HEADER_PREFIX + 'server-side-encryption', |
VERSION_ID_HEADER_KEY : AWS_HEADER_PREFIX + 'version-id', |
STORAGE_CLASS_HEADER_KEY : AWS_HEADER_PREFIX + 'storage-class', |
MFA_HEADER_KEY : AWS_HEADER_PREFIX + 'mfa', |
@@ -114,6 +125,9 @@ class Provider(object): |
'metadata-directive', |
RESUMABLE_UPLOAD_HEADER_KEY : GOOG_HEADER_PREFIX + 'resumable', |
SECURITY_TOKEN_HEADER_KEY : GOOG_HEADER_PREFIX + 'security-token', |
+ SERVER_SIDE_ENCRYPTION_KEY : None, |
+ # Note that this version header is not to be confused with |
+ # the Google Cloud Storage 'x-goog-api-version' header. |
VERSION_ID_HEADER_KEY : GOOG_HEADER_PREFIX + 'version-id', |
STORAGE_CLASS_HEADER_KEY : None, |
MFA_HEADER_KEY : None, |
@@ -137,10 +151,12 @@ class Provider(object): |
} |
} |
- def __init__(self, name, access_key=None, secret_key=None): |
+ def __init__(self, name, access_key=None, secret_key=None, |
+ security_token=None): |
self.host = None |
self.access_key = access_key |
self.secret_key = secret_key |
+ self.security_token = security_token |
self.name = name |
self.acl_class = self.AclClassMap[self.name] |
self.canned_acls = self.CannedAclsMap[self.name] |
@@ -188,6 +204,7 @@ class Provider(object): |
self.security_token_header = header_info_map[SECURITY_TOKEN_HEADER_KEY] |
self.resumable_upload_header = ( |
header_info_map[RESUMABLE_UPLOAD_HEADER_KEY]) |
+ self.server_side_encryption_header = header_info_map[SERVER_SIDE_ENCRYPTION_KEY] |
self.storage_class_header = header_info_map[STORAGE_CLASS_HEADER_KEY] |
self.version_id = header_info_map[VERSION_ID_HEADER_KEY] |
self.mfa_header = header_info_map[MFA_HEADER_KEY] |
@@ -203,6 +220,9 @@ class Provider(object): |
def get_provider_name(self): |
return self.HostKeyMap[self.name] |
+ def supports_chunked_transfer(self): |
+ return self.ChunkedTransferSupport[self.name] |
+ |
# Static utility method for getting default Provider. |
def get_default(): |
return Provider('aws') |