From 0c8af4992cb0f7589dcafaad65ada12753c64594 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 23 Nov 2022 21:14:33 +0300 Subject: initial --- .../Exception/DeleteMultipleObjectsException.php | 68 ++++++++++++++++++ .../S3/Exception/PermanentRedirectException.php | 4 ++ .../aws-sdk-php/src/S3/Exception/S3Exception.php | 9 +++ .../S3/Exception/S3MultipartUploadException.php | 84 ++++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 vendor/aws/aws-sdk-php/src/S3/Exception/DeleteMultipleObjectsException.php create mode 100644 vendor/aws/aws-sdk-php/src/S3/Exception/PermanentRedirectException.php create mode 100644 vendor/aws/aws-sdk-php/src/S3/Exception/S3Exception.php create mode 100644 vendor/aws/aws-sdk-php/src/S3/Exception/S3MultipartUploadException.php (limited to 'vendor/aws/aws-sdk-php/src/S3/Exception') diff --git a/vendor/aws/aws-sdk-php/src/S3/Exception/DeleteMultipleObjectsException.php b/vendor/aws/aws-sdk-php/src/S3/Exception/DeleteMultipleObjectsException.php new file mode 100644 index 0000000..5b4c289 --- /dev/null +++ b/vendor/aws/aws-sdk-php/src/S3/Exception/DeleteMultipleObjectsException.php @@ -0,0 +1,68 @@ +deleted = array_values($deleted); + $this->errors = array_values($errors); + parent::__construct('Unable to delete certain keys when executing a' + . ' DeleteMultipleObjects request: ' + . self::createMessageFromErrors($errors)); + } + + /** + * Create a single error message from multiple errors. + * + * @param array $errors Errors encountered + * + * @return string + */ + public static function createMessageFromErrors(array $errors) + { + return "\n- " . implode("\n- ", array_map(function ($key) { + return json_encode($key); + }, $errors)); + } + + /** + * Get the errored objects + * + * @return array Returns an array of associative arrays, each containing + * a 'Code', 'Message', and 'Key' key. + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Get the successfully deleted objects + * + * @return array Returns an array of associative arrays, each containing + * a 'Key' and optionally 'DeleteMarker' and + * 'DeleterMarkerVersionId' + */ + public function getDeleted() + { + return $this->deleted; + } +} diff --git a/vendor/aws/aws-sdk-php/src/S3/Exception/PermanentRedirectException.php b/vendor/aws/aws-sdk-php/src/S3/Exception/PermanentRedirectException.php new file mode 100644 index 0000000..67d916e --- /dev/null +++ b/vendor/aws/aws-sdk-php/src/S3/Exception/PermanentRedirectException.php @@ -0,0 +1,4 @@ +collectPathInfo($error->getCommand()); + } elseif ($prev instanceof AwsException) { + $this->collectPathInfo($prev->getCommand()); + } + parent::__construct($state, $prev); + } + + /** + * Get the Bucket information of the transfer object + * + * @return string|null Returns null when 'Bucket' information + * is unavailable. + */ + public function getBucket() + { + return $this->bucket; + } + + /** + * Get the Key information of the transfer object + * + * @return string|null Returns null when 'Key' information + * is unavailable. + */ + public function getKey() + { + return $this->key; + } + + /** + * Get the source file name of the transfer object + * + * @return string|null Returns null when metadata of the stream + * wrapped in 'Body' parameter is unavailable. + */ + public function getSourceFileName() + { + return $this->filename; + } + + /** + * Collect file path information when accessible. (Bucket, Key) + * + * @param CommandInterface $cmd + */ + private function collectPathInfo(CommandInterface $cmd) + { + if (empty($this->bucket) && isset($cmd['Bucket'])) { + $this->bucket = $cmd['Bucket']; + } + if (empty($this->key) && isset($cmd['Key'])) { + $this->key = $cmd['Key']; + } + if (empty($this->filename) && isset($cmd['Body'])) { + $this->filename = $cmd['Body']->getMetadata('uri'); + } + } +} -- cgit v1.2.3