UploadPartOutput.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <?php
  2. namespace AsyncAws\S3\Result;
  3. use AsyncAws\Core\Response;
  4. use AsyncAws\Core\Result;
  5. use AsyncAws\S3\Enum\RequestCharged;
  6. use AsyncAws\S3\Enum\ServerSideEncryption;
  7. class UploadPartOutput extends Result
  8. {
  9. /**
  10. * The server-side encryption algorithm used when storing this object in Amazon S3 (for example, `AES256`, `aws:kms`).
  11. */
  12. private $serverSideEncryption;
  13. /**
  14. * Entity tag for the uploaded object.
  15. */
  16. private $etag;
  17. /**
  18. * The base64-encoded, 32-bit CRC32 checksum of the object. This will only be present if it was uploaded with the
  19. * object. With multipart uploads, this may not be a checksum value of the object. For more information about how
  20. * checksums are calculated with multipart uploads, see Checking object integrity [^1] in the *Amazon S3 User Guide*.
  21. *
  22. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums
  23. */
  24. private $checksumCrc32;
  25. /**
  26. * The base64-encoded, 32-bit CRC32C checksum of the object. This will only be present if it was uploaded with the
  27. * object. With multipart uploads, this may not be a checksum value of the object. For more information about how
  28. * checksums are calculated with multipart uploads, see Checking object integrity [^1] in the *Amazon S3 User Guide*.
  29. *
  30. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums
  31. */
  32. private $checksumCrc32C;
  33. /**
  34. * The base64-encoded, 160-bit SHA-1 digest of the object. This will only be present if it was uploaded with the object.
  35. * With multipart uploads, this may not be a checksum value of the object. For more information about how checksums are
  36. * calculated with multipart uploads, see Checking object integrity [^1] in the *Amazon S3 User Guide*.
  37. *
  38. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums
  39. */
  40. private $checksumSha1;
  41. /**
  42. * The base64-encoded, 256-bit SHA-256 digest of the object. This will only be present if it was uploaded with the
  43. * object. With multipart uploads, this may not be a checksum value of the object. For more information about how
  44. * checksums are calculated with multipart uploads, see Checking object integrity [^1] in the *Amazon S3 User Guide*.
  45. *
  46. * [^1]: https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums
  47. */
  48. private $checksumSha256;
  49. /**
  50. * If server-side encryption with a customer-provided encryption key was requested, the response will include this
  51. * header confirming the encryption algorithm used.
  52. */
  53. private $sseCustomerAlgorithm;
  54. /**
  55. * If server-side encryption with a customer-provided encryption key was requested, the response will include this
  56. * header to provide round-trip message integrity verification of the customer-provided encryption key.
  57. */
  58. private $sseCustomerKeyMd5;
  59. /**
  60. * If present, specifies the ID of the Key Management Service (KMS) symmetric encryption customer managed key was used
  61. * for the object.
  62. */
  63. private $sseKmsKeyId;
  64. /**
  65. * Indicates whether the multipart upload uses an S3 Bucket Key for server-side encryption with Key Management Service
  66. * (KMS) keys (SSE-KMS).
  67. */
  68. private $bucketKeyEnabled;
  69. private $requestCharged;
  70. public function getBucketKeyEnabled(): ?bool
  71. {
  72. $this->initialize();
  73. return $this->bucketKeyEnabled;
  74. }
  75. public function getChecksumCrc32(): ?string
  76. {
  77. $this->initialize();
  78. return $this->checksumCrc32;
  79. }
  80. public function getChecksumCrc32C(): ?string
  81. {
  82. $this->initialize();
  83. return $this->checksumCrc32C;
  84. }
  85. public function getChecksumSha1(): ?string
  86. {
  87. $this->initialize();
  88. return $this->checksumSha1;
  89. }
  90. public function getChecksumSha256(): ?string
  91. {
  92. $this->initialize();
  93. return $this->checksumSha256;
  94. }
  95. public function getEtag(): ?string
  96. {
  97. $this->initialize();
  98. return $this->etag;
  99. }
  100. /**
  101. * @return RequestCharged::*|null
  102. */
  103. public function getRequestCharged(): ?string
  104. {
  105. $this->initialize();
  106. return $this->requestCharged;
  107. }
  108. /**
  109. * @return ServerSideEncryption::*|null
  110. */
  111. public function getServerSideEncryption(): ?string
  112. {
  113. $this->initialize();
  114. return $this->serverSideEncryption;
  115. }
  116. public function getSseCustomerAlgorithm(): ?string
  117. {
  118. $this->initialize();
  119. return $this->sseCustomerAlgorithm;
  120. }
  121. public function getSseCustomerKeyMd5(): ?string
  122. {
  123. $this->initialize();
  124. return $this->sseCustomerKeyMd5;
  125. }
  126. public function getSseKmsKeyId(): ?string
  127. {
  128. $this->initialize();
  129. return $this->sseKmsKeyId;
  130. }
  131. protected function populateResult(Response $response): void
  132. {
  133. $headers = $response->getHeaders();
  134. $this->serverSideEncryption = $headers['x-amz-server-side-encryption'][0] ?? null;
  135. $this->etag = $headers['etag'][0] ?? null;
  136. $this->checksumCrc32 = $headers['x-amz-checksum-crc32'][0] ?? null;
  137. $this->checksumCrc32C = $headers['x-amz-checksum-crc32c'][0] ?? null;
  138. $this->checksumSha1 = $headers['x-amz-checksum-sha1'][0] ?? null;
  139. $this->checksumSha256 = $headers['x-amz-checksum-sha256'][0] ?? null;
  140. $this->sseCustomerAlgorithm = $headers['x-amz-server-side-encryption-customer-algorithm'][0] ?? null;
  141. $this->sseCustomerKeyMd5 = $headers['x-amz-server-side-encryption-customer-key-md5'][0] ?? null;
  142. $this->sseKmsKeyId = $headers['x-amz-server-side-encryption-aws-kms-key-id'][0] ?? null;
  143. $this->bucketKeyEnabled = isset($headers['x-amz-server-side-encryption-bucket-key-enabled'][0]) ? filter_var($headers['x-amz-server-side-encryption-bucket-key-enabled'][0], \FILTER_VALIDATE_BOOLEAN) : null;
  144. $this->requestCharged = $headers['x-amz-request-charged'][0] ?? null;
  145. }
  146. }