MultipartUpload.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. namespace AsyncAws\S3\ValueObject;
  3. use AsyncAws\S3\Enum\ChecksumAlgorithm;
  4. use AsyncAws\S3\Enum\StorageClass;
  5. /**
  6. * Container for the `MultipartUpload` for the Amazon S3 object.
  7. */
  8. final class MultipartUpload
  9. {
  10. /**
  11. * Upload ID that identifies the multipart upload.
  12. */
  13. private $uploadId;
  14. /**
  15. * Key of the object for which the multipart upload was initiated.
  16. */
  17. private $key;
  18. /**
  19. * Date and time at which the multipart upload was initiated.
  20. */
  21. private $initiated;
  22. /**
  23. * The class of storage used to store the object.
  24. */
  25. private $storageClass;
  26. /**
  27. * Specifies the owner of the object that is part of the multipart upload.
  28. */
  29. private $owner;
  30. /**
  31. * Identifies who initiated the multipart upload.
  32. */
  33. private $initiator;
  34. /**
  35. * The algorithm that was used to create a checksum of the object.
  36. */
  37. private $checksumAlgorithm;
  38. /**
  39. * @param array{
  40. * UploadId?: null|string,
  41. * Key?: null|string,
  42. * Initiated?: null|\DateTimeImmutable,
  43. * StorageClass?: null|StorageClass::*,
  44. * Owner?: null|Owner|array,
  45. * Initiator?: null|Initiator|array,
  46. * ChecksumAlgorithm?: null|ChecksumAlgorithm::*,
  47. * } $input
  48. */
  49. public function __construct(array $input)
  50. {
  51. $this->uploadId = $input['UploadId'] ?? null;
  52. $this->key = $input['Key'] ?? null;
  53. $this->initiated = $input['Initiated'] ?? null;
  54. $this->storageClass = $input['StorageClass'] ?? null;
  55. $this->owner = isset($input['Owner']) ? Owner::create($input['Owner']) : null;
  56. $this->initiator = isset($input['Initiator']) ? Initiator::create($input['Initiator']) : null;
  57. $this->checksumAlgorithm = $input['ChecksumAlgorithm'] ?? null;
  58. }
  59. public static function create($input): self
  60. {
  61. return $input instanceof self ? $input : new self($input);
  62. }
  63. /**
  64. * @return ChecksumAlgorithm::*|null
  65. */
  66. public function getChecksumAlgorithm(): ?string
  67. {
  68. return $this->checksumAlgorithm;
  69. }
  70. public function getInitiated(): ?\DateTimeImmutable
  71. {
  72. return $this->initiated;
  73. }
  74. public function getInitiator(): ?Initiator
  75. {
  76. return $this->initiator;
  77. }
  78. public function getKey(): ?string
  79. {
  80. return $this->key;
  81. }
  82. public function getOwner(): ?Owner
  83. {
  84. return $this->owner;
  85. }
  86. /**
  87. * @return StorageClass::*|null
  88. */
  89. public function getStorageClass(): ?string
  90. {
  91. return $this->storageClass;
  92. }
  93. public function getUploadId(): ?string
  94. {
  95. return $this->uploadId;
  96. }
  97. }