Skip to content
Merged
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
39 changes: 19 additions & 20 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions src/Storage/Device/Wasabi.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

namespace Utopia\Storage\Device;

use Utopia\Storage\Device\S3;

class Wasabi extends S3
{
/**
* Regions constants
*
*/
const US_WEST_1='us-west-1';
const AP_NORTHEAST_1='ap-northeast-1';
const AP_NORTHEAST_2='ap-northeast-2';
const EU_CENTRAL_1='eu-central-1';
const EU_CENTRAL_2='eu-central-2';
const EU_WEST_1='eu-west-1';
const EU_WEST_2='eu-west-2';
const US_CENTRAL_1='us-central-1';
const US_EAST_1='eu-east-1';
const US_EAST_2='eu-east-2';


/**
* Wasabi 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::EU_CENTRAL_1, string $acl = self::ACL_PRIVATE)
{
parent::__construct($root, $accessKey, $secretKey, $bucket, $region, $acl);
$this->headers['host'] = $bucket . '.'.'s3'.'.'.$region.'.'.'wasabisys'.'.'.'com';
}

/**
* @return string
*/
public function getName(): string
{
return 'Wasabi Storage';
}

/**
* @return string
*/
public function getDescription(): string
{
return 'Wasabi Storage';
}
}
1 change: 1 addition & 0 deletions src/Storage/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Storage
const DEVICE_LOCAL = 'Local';
const DEVICE_S3 = 'S3';
const DEVICE_DO_SPACES = 'DOSpaces';
const DEVICE_WASABI = 'Wasabi';

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

namespace Utopia\Tests;

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

class WasabiTest extends S3Base
{
protected function init(): void
{
$this->root = 'root';
$key = $_SERVER['WASABI_ACCESS_KEY'] ?? '';
$secret = $_SERVER['WASABI_SECRET'] ?? '';
$bucket = "";

$this->object = new Wasabi($this->root, $key, $secret, $bucket, Wasabi::EU_CENTRAL_1, WASABI::ACL_PRIVATE);

}

protected function getAdapterName(): string
{
return 'Wasabi Storage';
}

protected function getAdapterDescription(): string
{
return 'Wasabi Storage';
}
}