-
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
feat: add yandex storage adapter #102
Open
hydromoll
wants to merge
6
commits into
utopia-php:main
Choose a base branch
from
hydromoll:feat-7026-Yandex-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 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2e16ecf
feat: add yandex storage adapter
hydromoll 1010801
Update Yandex.php
hydromoll 1ee732e
feat: fix lint errors
hydromoll 3f351bf
Merge branch 'feat-7026-Yandex-storage-adapter' of https://github.com…
hydromoll 6d5d94c
fix php unit
hydromoll 7c9e239
feat: remove yandex test
hydromoll 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,56 @@ | ||
<?php | ||
|
||
namespace Utopia\Storage\Device; | ||
|
||
use Utopia\Storage\Storage; | ||
|
||
class Yandex extends S3 | ||
{ | ||
/** | ||
* Regions constants | ||
*/ | ||
const RU_CENTRAL_A = 'ru-central1-a'; | ||
|
||
const RU_CENTRAL_B = 'ru-central1-b'; | ||
|
||
const RU_CENTRAL_C = 'ru-central1-c'; | ||
|
||
/** | ||
* YandexStorage Constructor | ||
* | ||
* @param string $root | ||
* @param string $accessKey | ||
* @param string $secretKey | ||
* @param string $bucket | ||
* @param string $acl | ||
*/ | ||
public function __construct(string $root, string $accessKey, string $secretKey, string $bucket, string $region = self::RU_CENTRAL_A, string $acl = self::ACL_PRIVATE) | ||
{ | ||
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl); | ||
$this->headers['host'] = $bucket.'.storage.yandexcloud.net'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName(): string | ||
{ | ||
return 'Yandex Storage'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDescription(): string | ||
{ | ||
return 'Yandex Storage'; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getType(): string | ||
{ | ||
return Storage::DEVICE_YANDEX; | ||
} | ||
} |
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,35 @@ | ||
<?php | ||
|
||
namespace Utopia\Tests\Storage\Device; | ||
|
||
use Utopia\Storage\Device\Yandex; | ||
use Utopia\Tests\Storage\S3Base; | ||
|
||
class YandexTest extends S3Base | ||
{ | ||
protected function init(): void | ||
{ | ||
$this->root = '/root'; | ||
$key = $_SERVER['YANDEX_ACCESS_KEY'] ?? ''; | ||
$secret = $_SERVER['YANDEX_SECRET'] ?? ''; | ||
$bucket = 'utopia-storage-tests'; | ||
$region = 'ru-central1-a'; | ||
|
||
$this->object = new Yandex($this->root, $key, $secret, $bucket, $region, Yandex::ACL_PRIVATE); | ||
} | ||
|
||
protected function getAdapterName(): string | ||
{ | ||
return 'Yandex Storage'; | ||
} | ||
|
||
protected function getAdapterType(): string | ||
{ | ||
return $this->object->getType(); | ||
} | ||
|
||
protected function getAdapterDescription(): string | ||
{ | ||
return 'Yandex 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.
This isn't needed. It should be included automatically in the e2e test suite. Also, tests against a 3rd party service should definitely not be in unit tests.