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

Side by Side Diff: boto/storage_uri.py

Issue 8669001: Pull in upstream boto from github at bcb719937de9ac2851e632d62b777352029a6d55 (Closed) Base URL: svn://svn.chromium.org/boto
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « boto/sqs/queue.py ('k') | boto/utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2010 Google Inc. 1 # Copyright 2010 Google Inc.
2 # Copyright (c) 2011, Nexenta Systems Inc. 2 # Copyright (c) 2011, Nexenta Systems Inc.
3 # 3 #
4 # Permission is hereby granted, free of charge, to any person obtaining a 4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the 5 # copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including 6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish, dis- 7 # without limitation the rights to use, copy, modify, merge, publish, dis-
8 # tribute, sublicense, and/or sell copies of the Software, and to permit 8 # tribute, sublicense, and/or sell copies of the Software, and to permit
9 # persons to whom the Software is furnished to do so, subject to the fol- 9 # persons to whom the Software is furnished to do so, subject to the fol-
10 # lowing conditions: 10 # lowing conditions:
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 @type new_name: string 216 @type new_name: string
217 @param new_name: new object name 217 @param new_name: new object name
218 """ 218 """
219 if not self.bucket_name: 219 if not self.bucket_name:
220 raise InvalidUriError('clone_replace_name() on bucket-less URI %s' % 220 raise InvalidUriError('clone_replace_name() on bucket-less URI %s' %
221 self.uri) 221 self.uri)
222 return BucketStorageUri(self.scheme, self.bucket_name, new_name, 222 return BucketStorageUri(self.scheme, self.bucket_name, new_name,
223 self.debug) 223 self.debug)
224 224
225 def get_acl(self, validate=True, headers=None, version_id=None): 225 def get_acl(self, validate=True, headers=None, version_id=None):
226 """returns a bucket's acl"""
226 if not self.bucket_name: 227 if not self.bucket_name:
227 raise InvalidUriError('get_acl on bucket-less URI (%s)' % self.uri) 228 raise InvalidUriError('get_acl on bucket-less URI (%s)' % self.uri)
228 bucket = self.get_bucket(validate, headers) 229 bucket = self.get_bucket(validate, headers)
229 # This works for both bucket- and object- level ACLs (former passes 230 # This works for both bucket- and object- level ACLs (former passes
230 # key_name=None): 231 # key_name=None):
231 acl = bucket.get_acl(self.object_name, headers, version_id) 232 acl = bucket.get_acl(self.object_name, headers, version_id)
232 self.check_response(acl, 'acl', self.uri) 233 self.check_response(acl, 'acl', self.uri)
233 return acl 234 return acl
234 235
236 def get_def_acl(self, validate=True, headers=None):
237 """returns a bucket's default object acl"""
238 if not self.bucket_name:
239 raise InvalidUriError('get_acl on bucket-less URI (%s)' % self.uri)
240 bucket = self.get_bucket(validate, headers)
241 # This works for both bucket- and object- level ACLs (former passes
242 # key_name=None):
243 acl = bucket.get_def_acl(self.object_name, headers)
244 self.check_response(acl, 'acl', self.uri)
245 return acl
246
235 def get_location(self, validate=True, headers=None): 247 def get_location(self, validate=True, headers=None):
236 if not self.bucket_name: 248 if not self.bucket_name:
237 raise InvalidUriError('get_location on bucket-less URI (%s)' % 249 raise InvalidUriError('get_location on bucket-less URI (%s)' %
238 self.uri) 250 self.uri)
239 bucket = self.get_bucket(validate, headers) 251 bucket = self.get_bucket(validate, headers)
240 return bucket.get_location() 252 return bucket.get_location()
241 253
242 def get_subresource(self, subresource, validate=True, headers=None, 254 def get_subresource(self, subresource, validate=True, headers=None,
243 version_id=None): 255 version_id=None):
244 if not self.bucket_name: 256 if not self.bucket_name:
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return conn.get_all_buckets(headers) 349 return conn.get_all_buckets(headers)
338 350
339 def get_provider(self): 351 def get_provider(self):
340 conn = self.connect() 352 conn = self.connect()
341 provider = conn.provider 353 provider = conn.provider
342 self.check_response(provider, 'provider', self.uri) 354 self.check_response(provider, 'provider', self.uri)
343 return provider 355 return provider
344 356
345 def set_acl(self, acl_or_str, key_name='', validate=True, headers=None, 357 def set_acl(self, acl_or_str, key_name='', validate=True, headers=None,
346 version_id=None): 358 version_id=None):
359 """sets or updates a bucket's acl"""
347 if not self.bucket_name: 360 if not self.bucket_name:
348 raise InvalidUriError('set_acl on bucket-less URI (%s)' % 361 raise InvalidUriError('set_acl on bucket-less URI (%s)' %
349 self.uri) 362 self.uri)
350 self.get_bucket(validate, headers).set_acl(acl_or_str, key_name, 363 self.get_bucket(validate, headers).set_acl(acl_or_str, key_name,
351 headers, version_id) 364 headers, version_id)
352 365
366 def set_def_acl(self, acl_or_str, key_name='', validate=True, headers=None,
367 version_id=None):
368 """sets or updates a bucket's default object acl"""
369 if not self.bucket_name:
370 raise InvalidUriError('set_acl on bucket-less URI (%s)' %
371 self.uri)
372 self.get_bucket(validate, headers).set_def_acl(acl_or_str, key_name,
373 headers)
374
353 def set_canned_acl(self, acl_str, validate=True, headers=None, 375 def set_canned_acl(self, acl_str, validate=True, headers=None,
354 version_id=None): 376 version_id=None):
377 """sets or updates a bucket's acl to a predefined (canned) value"""
355 if not self.object_name: 378 if not self.object_name:
356 raise InvalidUriError('set_canned_acl on object-less URI (%s)' % 379 raise InvalidUriError('set_canned_acl on object-less URI (%s)' %
357 self.uri) 380 self.uri)
358 key = self.get_key(validate, headers) 381 key = self.get_key(validate, headers)
359 self.check_response(key, 'key', self.uri) 382 self.check_response(key, 'key', self.uri)
360 key.set_canned_acl(acl_str, headers, version_id) 383 key.set_canned_acl(acl_str, headers, version_id)
361 384
385 def set_def_canned_acl(self, acl_str, validate=True, headers=None,
386 version_id=None):
387 """sets or updates a bucket's default object acl to a predefined
388 (canned) value"""
389 if not self.object_name:
390 raise InvalidUriError('set_canned_acl on object-less URI (%s)' %
391 self.uri)
392 key = self.get_key(validate, headers)
393 self.check_response(key, 'key', self.uri)
394 key.set_def_canned_acl(acl_str, headers, version_id)
395
362 def set_subresource(self, subresource, value, validate=True, headers=None, 396 def set_subresource(self, subresource, value, validate=True, headers=None,
363 version_id=None): 397 version_id=None):
364 if not self.bucket_name: 398 if not self.bucket_name:
365 raise InvalidUriError( 399 raise InvalidUriError(
366 'set_subresource on bucket-less URI (%s)' % self.uri) 400 'set_subresource on bucket-less URI (%s)' % self.uri)
367 bucket = self.get_bucket(validate, headers) 401 bucket = self.get_bucket(validate, headers)
368 bucket.set_subresource(subresource, value, self.object_name, headers, 402 bucket.set_subresource(subresource, value, self.object_name, headers,
369 version_id) 403 version_id)
370 404
371 def set_contents_from_string(self, s, headers=None, replace=True, 405 def set_contents_from_string(self, s, headers=None, replace=True,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 def is_file_uri(self): 486 def is_file_uri(self):
453 return True 487 return True
454 488
455 def is_cloud_uri(self): 489 def is_cloud_uri(self):
456 return False 490 return False
457 491
458 def is_stream(self): 492 def is_stream(self):
459 """Retruns True if this URI represents input/output stream. 493 """Retruns True if this URI represents input/output stream.
460 """ 494 """
461 return self.stream 495 return self.stream
OLDNEW
« no previous file with comments | « boto/sqs/queue.py ('k') | boto/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698