-
Notifications
You must be signed in to change notification settings - Fork 62
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
bannu0snake
wants to merge
1
commit into
utopia-php:main
Choose a base branch
from
bannu0snake:feat-3985-arubacloud-storage-adapter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
* | ||
*/ | ||
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; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?