Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: third_party/gsutil/boto/boto/provider.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/gsutil/boto/boto/plugin.py ('k') | third_party/gsutil/boto/boto/pyami/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/gsutil/boto/boto/provider.py
diff --git a/third_party/gsutil/20110627/boto/boto/provider.py b/third_party/gsutil/boto/boto/provider.py
similarity index 87%
rename from third_party/gsutil/20110627/boto/boto/provider.py
rename to third_party/gsutil/boto/boto/provider.py
index 1ef3d86103fe204d3b904e5db729b3fba6dcc33d..37ceae720db7bdf06f21bd71744248b2d60fa84d 100644
--- a/third_party/gsutil/20110627/boto/boto/provider.py
+++ b/third_party/gsutil/boto/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
@@ -43,6 +44,7 @@ ACL_HEADER_KEY = 'acl-header'
AUTH_HEADER_KEY = 'auth-header'
COPY_SOURCE_HEADER_KEY = 'copy-source-header'
COPY_SOURCE_VERSION_ID_HEADER_KEY = 'copy-source-version-id-header'
+COPY_SOURCE_RANGE_HEADER_KEY = 'copy-source-range-header'
DELETE_MARKER_HEADER_KEY = 'delete-marker-header'
DATE_HEADER_KEY = 'date-header'
METADATA_DIRECTIVE_HEADER_KEY = 'metadata-directive-header'
@@ -50,6 +52,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 +84,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,
@@ -90,12 +101,15 @@ class Provider(object):
COPY_SOURCE_HEADER_KEY : AWS_HEADER_PREFIX + 'copy-source',
COPY_SOURCE_VERSION_ID_HEADER_KEY : AWS_HEADER_PREFIX +
'copy-source-version-id',
+ COPY_SOURCE_RANGE_HEADER_KEY : AWS_HEADER_PREFIX +
+ 'copy-source-range',
DATE_HEADER_KEY : AWS_HEADER_PREFIX + 'date',
DELETE_MARKER_HEADER_KEY : AWS_HEADER_PREFIX + 'delete-marker',
METADATA_DIRECTIVE_HEADER_KEY : AWS_HEADER_PREFIX +
'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',
@@ -108,14 +122,16 @@ class Provider(object):
COPY_SOURCE_HEADER_KEY : GOOG_HEADER_PREFIX + 'copy-source',
COPY_SOURCE_VERSION_ID_HEADER_KEY : GOOG_HEADER_PREFIX +
'copy-source-version-id',
+ COPY_SOURCE_RANGE_HEADER_KEY : None,
DATE_HEADER_KEY : GOOG_HEADER_PREFIX + 'date',
DELETE_MARKER_HEADER_KEY : GOOG_HEADER_PREFIX + 'delete-marker',
METADATA_DIRECTIVE_HEADER_KEY : GOOG_HEADER_PREFIX +
'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 Storage 'x-goog-api-version' header.
+ # 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,
@@ -139,10 +155,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]
@@ -183,6 +201,8 @@ class Provider(object):
self.copy_source_header = header_info_map[COPY_SOURCE_HEADER_KEY]
self.copy_source_version_id = header_info_map[
COPY_SOURCE_VERSION_ID_HEADER_KEY]
+ self.copy_source_range_header = header_info_map[
+ COPY_SOURCE_RANGE_HEADER_KEY]
self.date_header = header_info_map[DATE_HEADER_KEY]
self.delete_marker = header_info_map[DELETE_MARKER_HEADER_KEY]
self.metadata_directive_header = (
@@ -190,6 +210,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]
@@ -205,6 +226,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')
« no previous file with comments | « third_party/gsutil/boto/boto/plugin.py ('k') | third_party/gsutil/boto/boto/pyami/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698