|
11 | 11 | from gcloud.storage.iterator import Iterator |
12 | 12 |
|
13 | 13 |
|
| 14 | +def _scalar_property(fieldname): |
| 15 | + """Create a property descriptor around the :class:`_PropertyMixin` helpers. |
| 16 | + """ |
| 17 | + def _getter(self): |
| 18 | + return self.properties[fieldname] |
| 19 | + |
| 20 | + def _setter(self, value): |
| 21 | + self._patch_properties({fieldname: value}) |
| 22 | + |
| 23 | + return property(_getter, _setter) |
| 24 | + |
| 25 | + |
14 | 26 | class Key(_PropertyMixin): |
15 | 27 | """A wrapper around Cloud Storage's concept of an ``Object``.""" |
16 | 28 |
|
@@ -378,137 +390,59 @@ def make_public(self): |
378 | 390 | self.acl.save() |
379 | 391 | return self |
380 | 392 |
|
381 | | - @property |
382 | | - def cache_control(self): |
383 | | - """Retrieve HTTP 'Cache-Control' header for this object. |
384 | | -
|
385 | | - See: https://tools.ietf.org/html/rfc7234#section-5.2 and |
386 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
387 | | -
|
388 | | - :rtype: string |
389 | | - """ |
390 | | - return self.properties['cacheControl'] |
391 | | - |
392 | | - @cache_control.setter |
393 | | - def cache_control(self, value): |
394 | | - """Update HTTP 'Cache-Control' header for this object. |
395 | | -
|
396 | | - See: https://tools.ietf.org/html/rfc7234#section-5.2 and |
397 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
398 | | -
|
399 | | - :type value: string |
400 | | - """ |
401 | | - self._patch_properties({'cacheControl': value}) |
402 | | - |
403 | | - @property |
404 | | - def content_disposition(self): |
405 | | - """Retrieve HTTP 'Content-Disposition' header for this object. |
406 | | -
|
407 | | - See: https://tools.ietf.org/html/rfc6266 and |
408 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
409 | | -
|
410 | | - :rtype: string |
411 | | - """ |
412 | | - return self.properties['contentDisposition'] |
413 | | - |
414 | | - @content_disposition.setter |
415 | | - def content_disposition(self, value): |
416 | | - """Update HTTP 'Content-Disposition' header for this object. |
| 393 | + cache_control = _scalar_property('cacheControl') |
| 394 | + """HTTP 'Cache-Control' header for this object. |
417 | 395 |
|
418 | | - See: https://tools.ietf.org/html/rfc6266 and |
419 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
420 | | -
|
421 | | - :type value: string |
422 | | - """ |
423 | | - self._patch_properties({'contentDisposition': value}) |
424 | | - |
425 | | - @property |
426 | | - def content_encoding(self): |
427 | | - """Retrieve HTTP 'Content-Encoding' header for this object. |
| 396 | + See: https://tools.ietf.org/html/rfc7234#section-5.2 and |
| 397 | + https://cloud.google.com/storage/docs/json_api/v1/objects |
428 | 398 |
|
429 | | - See: https://tools.ietf.org/html/rfc7231#section-3.1.2.2 and |
430 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
431 | | -
|
432 | | - :rtype: string |
433 | | - """ |
434 | | - return self.properties['contentEncoding'] |
435 | | - |
436 | | - @content_encoding.setter |
437 | | - def content_encoding(self, value): |
438 | | - """Update HTTP 'Content-Encoding' header for this object. |
439 | | -
|
440 | | - See: https://tools.ietf.org/html/rfc7231#section-3.1.2.2 and |
441 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
442 | | -
|
443 | | - :type value: string |
444 | | - """ |
445 | | - self._patch_properties({'contentEncoding': value}) |
| 399 | + :rtype: string |
| 400 | + """ |
446 | 401 |
|
447 | | - @property |
448 | | - def content_language(self): |
449 | | - """Retrieve HTTP 'Content-Language' header for this object. |
| 402 | + content_disposition = _scalar_property('contentDisposition') |
| 403 | + """HTTP 'Content-Disposition' header for this object. |
450 | 404 |
|
451 | | - See: http://tools.ietf.org/html/bcp47 and |
452 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
453 | | -
|
454 | | - :rtype: string |
455 | | - """ |
456 | | - return self.properties['contentLanguage'] |
| 405 | + See: https://tools.ietf.org/html/rfc6266 and |
| 406 | + https://cloud.google.com/storage/docs/json_api/v1/objects |
457 | 407 |
|
458 | | - @content_language.setter |
459 | | - def content_language(self, value): |
460 | | - """Update HTTP 'Content-Language' header for this object. |
| 408 | + :rtype: string |
| 409 | + """ |
461 | 410 |
|
462 | | - See: http://tools.ietf.org/html/bcp47 and |
463 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
| 411 | + content_encoding = _scalar_property('contentEncoding') |
| 412 | + """HTTP 'Content-Encoding' header for this object. |
464 | 413 |
|
465 | | - :type value: string |
466 | | - """ |
467 | | - self._patch_properties({'contentLanguage': value}) |
| 414 | + See: https://tools.ietf.org/html/rfc7231#section-3.1.2.2 and |
| 415 | + https://cloud.google.com/storage/docs/json_api/v1/objects |
468 | 416 |
|
469 | | - @property |
470 | | - def content_type(self): |
471 | | - """Retrieve HTTP 'Content-Type' header for this object. |
472 | | -
|
473 | | - See: https://tools.ietf.org/html/rfc2616#section-14.17 and |
474 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
| 417 | + :rtype: string |
| 418 | + """ |
475 | 419 |
|
476 | | - :rtype: string |
477 | | - """ |
478 | | - return self.properties['contentType'] |
| 420 | + content_language = _scalar_property('contentLanguage') |
| 421 | + """HTTP 'Content-Language' header for this object. |
479 | 422 |
|
480 | | - @content_type.setter |
481 | | - def content_type(self, value): |
482 | | - """Update HTTP 'Content-Type' header for this object. |
| 423 | + See: http://tools.ietf.org/html/bcp47 and |
| 424 | + https://cloud.google.com/storage/docs/json_api/v1/objects |
483 | 425 |
|
484 | | - See: https://tools.ietf.org/html/rfc2616#section-14.17 and |
485 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
| 426 | + :rtype: string |
| 427 | + """ |
486 | 428 |
|
487 | | - :type value: string |
488 | | - """ |
489 | | - self._patch_properties({'contentType': value}) |
| 429 | + content_type = _scalar_property('contentType') |
| 430 | + """HTTP 'Content-Type' header for this object. |
490 | 431 |
|
491 | | - @property |
492 | | - def crc32c(self): |
493 | | - """Retrieve CRC32C checksum for this object. |
| 432 | + See: https://tools.ietf.org/html/rfc2616#section-14.17 and |
| 433 | + https://cloud.google.com/storage/docs/json_api/v1/objects |
494 | 434 |
|
495 | | - See: http://tools.ietf.org/html/rfc4960#appendix-B and |
496 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
| 435 | + :rtype: string |
| 436 | + """ |
497 | 437 |
|
498 | | - :rtype: string |
499 | | - """ |
500 | | - return self.properties['crc32c'] |
| 438 | + crc32c = _scalar_property('crc32c') |
| 439 | + """CRC32C checksum for this object. |
501 | 440 |
|
502 | | - @crc32c.setter |
503 | | - def crc32c(self, value): |
504 | | - """Update CRC32C checksum for this object. |
| 441 | + See: http://tools.ietf.org/html/rfc4960#appendix-B and |
| 442 | + https://cloud.google.com/storage/docs/json_api/v1/objects |
505 | 443 |
|
506 | | - See: http://tools.ietf.org/html/rfc4960#appendix-B and |
507 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
508 | | -
|
509 | | - :type value: string |
510 | | - """ |
511 | | - self._patch_properties({'crc32c': value}) |
| 444 | + :rtype: string |
| 445 | + """ |
512 | 446 |
|
513 | 447 | @property |
514 | 448 | def component_count(self): |
@@ -551,27 +485,14 @@ def id(self): |
551 | 485 | """ |
552 | 486 | return self.properties['id'] |
553 | 487 |
|
554 | | - @property |
555 | | - def md5_hash(self): |
556 | | - """Retrieve MD5 hash for this object. |
557 | | -
|
558 | | - See: http://tools.ietf.org/html/rfc4960#appendix-B and |
559 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
560 | | -
|
561 | | - :rtype: string |
562 | | - """ |
563 | | - return self.properties['md5Hash'] |
| 488 | + md5_hash = _scalar_property('md5Hash') |
| 489 | + """MD5 hash for this object. |
564 | 490 |
|
565 | | - @md5_hash.setter |
566 | | - def md5_hash(self, value): |
567 | | - """Update MD5 hash for this object. |
| 491 | + See: http://tools.ietf.org/html/rfc4960#appendix-B and |
| 492 | + https://cloud.google.com/storage/docs/json_api/v1/objects |
568 | 493 |
|
569 | | - See: http://tools.ietf.org/html/rfc4960#appendix-B and |
570 | | - https://cloud.google.com/storage/docs/json_api/v1/objects |
571 | | -
|
572 | | - :type value: string |
573 | | - """ |
574 | | - self._patch_properties({'md5Hash': value}) |
| 494 | + :rtype: string |
| 495 | + """ |
575 | 496 |
|
576 | 497 | @property |
577 | 498 | def media_link(self): |
|
0 commit comments