Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ArubaCloud Storage adapter #98

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ services:
- BACKBLAZE_ACCESS_KEY
- BACKBLAZE_SECRET
- WASABI_ACCESS_KEY
- WASABI_SECRET
- WASABI_SECRET
- ARUBACLOUD_ACCESS_KEY
- ARUBACLOUD_SECRET
65 changes: 65 additions & 0 deletions src/Storage/Device/ArubaCloud.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace Utopia\Storage\Device;

use Utopia\Storage\Storage;

final class ArubaCloud extends S3
{
/**
* Region constants
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please add a link to the reference material you used to determine the regions?

*/
const R1_IT = 'r1-it';

const R1_CZ = 'r1-cz';

const R1_FR = 'r1-fr';

const R1_DE = 'r1-de';

const R1_UK = 'r1-uk';

const R1_PL = 'r1-pl';

/**
* ArubaCloud Constructor
*
* @param string $root
* @param string $accessKey
* @param string $secretKey
* @param string $bucket
* @param string $region
* @param string $acl
*/
public function __construct(string $root, string $accessKey, string $secretKey, string $bucket, string $region = self::R1_IT, string $acl = self::ACL_PRIVATE)
{
parent::__construct($root, $accessKey, $secretKey, $bucket, $region);
$this->headers['host'] = 's3.arubacloud.com/' . $bucket;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you can put a path in the host header 🧐

}


/**
* @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';
}
}
2 changes: 2 additions & 0 deletions src/Storage/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class Storage

const DEVICE_LINODE = 'linode';

const DEVICE_ARUBA_CLOUD = 'arubacloud';

/**
* Devices.
*
Expand Down
34 changes: 34 additions & 0 deletions tests/Storage/Device/ArubaCloudTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace Utopia\Tests\Storage\Device;

use Utopia\Storage\Device\ArubaCloud;
use Utopia\Tests\Storage\S3Base;

class ArubaCloudTest extends S3Base
{
protected function init(): void
{
$this->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';
}
}
Loading