From 4069fdc9ad158b035d8a5893e7cbb64970cdaeb1 Mon Sep 17 00:00:00 2001 From: aloks98 Date: Sat, 29 Oct 2022 01:54:09 +0530 Subject: [PATCH] feat: add dreamobjects storage --- src/Storage/Device/DreamObjects.php | 46 +++++++++++++++++++++++ src/Storage/Storage.php | 1 + tests/Storage/Device/DreamObjectsTest.php | 30 +++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 src/Storage/Device/DreamObjects.php create mode 100644 tests/Storage/Device/DreamObjectsTest.php diff --git a/src/Storage/Device/DreamObjects.php b/src/Storage/Device/DreamObjects.php new file mode 100644 index 00000000..e5e09ab5 --- /dev/null +++ b/src/Storage/Device/DreamObjects.php @@ -0,0 +1,46 @@ +headers['host'] = $bucket.'objects-'.$region.'.'.'dream.io'; + } + + /** + * @return string + */ + public function getName(): string + { + return 'DreamHost Object Storage'; + } + + /** + * @return string + */ + public function getDescription(): string + { + return 'DreamHost Object Storage'; + } +} diff --git a/src/Storage/Storage.php b/src/Storage/Storage.php index 4e075305..22d9aba7 100644 --- a/src/Storage/Storage.php +++ b/src/Storage/Storage.php @@ -16,6 +16,7 @@ class Storage const DEVICE_WASABI = 'Wasabi'; const DEVICE_BACKBLAZE = 'Backblaze'; const DEVICE_LINODE= 'Linode'; + const DEVICE_DREAMOBJECTS = 'DreamObjects'; /** * Devices. diff --git a/tests/Storage/Device/DreamObjectsTest.php b/tests/Storage/Device/DreamObjectsTest.php new file mode 100644 index 00000000..f52594b0 --- /dev/null +++ b/tests/Storage/Device/DreamObjectsTest.php @@ -0,0 +1,30 @@ +root = '/root'; + $key = $_SERVER['DREAMOBJECTS_ACCESS_KEY'] ?? ''; + $secret = $_SERVER['DREAMOBJECTS_SECRET'] ?? ''; + $bucket = "utopia-dreamobjects-store"; + + $this->object = new DreamObjects($this->root, $key, $secret, $bucket, DreamObjects::US_EAST_1, DreamObjects::ACL_PUBLIC_READ); + + } + + protected function getAdapterName(): string + { + return 'DreamHost Object Storage'; + } + + protected function getAdapterDescription(): string + { + return 'DreamHost Object Storage'; + } +}