From a601d8834b4b69232ab59286a14660291f3a85b1 Mon Sep 17 00:00:00 2001 From: Mahaboob Shaik Date: Thu, 5 Oct 2023 08:19:46 +0530 Subject: [PATCH] Added ArubaCloud Storage adapter --- docker-compose.yml | 4 +- src/Storage/Device/ArubaCloud.php | 65 +++++++++++++++++++++++++ src/Storage/Storage.php | 2 + tests/Storage/Device/ArubaCloudTest.php | 34 +++++++++++++ 4 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 src/Storage/Device/ArubaCloud.php create mode 100644 tests/Storage/Device/ArubaCloudTest.php diff --git a/docker-compose.yml b/docker-compose.yml index 4cd5e9f7..a29bbc81 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,4 +20,6 @@ services: - BACKBLAZE_ACCESS_KEY - BACKBLAZE_SECRET - WASABI_ACCESS_KEY - - WASABI_SECRET \ No newline at end of file + - WASABI_SECRET + - ARUBACLOUD_ACCESS_KEY + - ARUBACLOUD_SECRET \ No newline at end of file diff --git a/src/Storage/Device/ArubaCloud.php b/src/Storage/Device/ArubaCloud.php new file mode 100644 index 00000000..93bd0055 --- /dev/null +++ b/src/Storage/Device/ArubaCloud.php @@ -0,0 +1,65 @@ +headers['host'] = 's3.arubacloud.com/' . $bucket; + } + + + /** + * @return string + */ + public function getName(): string + { + return 'Aruba Cloud Storage'; + } + + /** + * @return string + */ + public function getType(): string + { + return Storage::DEVICE_ARUBA_CLOUD; + } + + /** + * @return string + */ + public function getDescription(): string + { + return 'Aruba Cloud Storage'; + } +} diff --git a/src/Storage/Storage.php b/src/Storage/Storage.php index cabd18c8..d5aa4b79 100644 --- a/src/Storage/Storage.php +++ b/src/Storage/Storage.php @@ -21,6 +21,8 @@ class Storage const DEVICE_LINODE = 'linode'; + const DEVICE_ARUBA_CLOUD = 'arubacloud'; + /** * Devices. * diff --git a/tests/Storage/Device/ArubaCloudTest.php b/tests/Storage/Device/ArubaCloudTest.php new file mode 100644 index 00000000..6a7f6d51 --- /dev/null +++ b/tests/Storage/Device/ArubaCloudTest.php @@ -0,0 +1,34 @@ +root = '/root'; + $key = $_SERVER['ARUBACLOUD_ACCESS_KEY'] ?? ''; + $secret = $_SERVER['ARUBACLOUD_SECRET'] ?? ''; + $bucket = 'utopia-storage-test'; + + $this->object = new ArubaCloud($this->root, $key, $secret, $bucket, ArubaCloud::R1_IT, ArubaCloud::ACL_PRIVATE); + } + + protected function getAdapterName(): string + { + return 'Aruba Cloud Storage'; + } + + protected function getAdapterType(): string + { + return $this->object->getType(); + } + + protected function getAdapterDescription(): string + { + return 'Aruba Cloud Storage'; + } +}