1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
// --------------------------------------------------------------------- |
4
|
|
|
// |
5
|
|
|
// Copyright (C) 2018-2024 Artem Rodygin |
6
|
|
|
// |
7
|
|
|
// You should have received a copy of the MIT License along with |
8
|
|
|
// this file. If not, see <https://opensource.org/licenses/MIT>. |
9
|
|
|
// |
10
|
|
|
// --------------------------------------------------------------------- |
11
|
|
|
|
12
|
|
|
namespace Linode\ObjectStorage\Repository; |
13
|
|
|
|
14
|
|
|
use Linode\Entity; |
15
|
|
|
use Linode\Internal\AbstractRepository; |
16
|
|
|
use Linode\ObjectStorage\ObjectStorageCluster; |
17
|
|
|
use Linode\ObjectStorage\ObjectStorageClusterRepositoryInterface; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @codeCoverageIgnore This class was autogenerated. |
21
|
|
|
*/ |
22
|
|
|
class ObjectStorageClusterRepository extends AbstractRepository implements ObjectStorageClusterRepositoryInterface |
23
|
|
|
{ |
24
|
|
|
public function getObjectStorageBuckets(): array |
25
|
|
|
{ |
26
|
|
|
$response = $this->client->get('/object-storage/buckets'); |
27
|
|
|
$contents = $response->getBody()->getContents(); |
28
|
|
|
|
29
|
|
|
return json_decode($contents, true); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
protected function getBaseUri(): string |
33
|
|
|
{ |
34
|
|
|
return '/object-storage/clusters'; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
protected function getSupportedFields(): array |
38
|
|
|
{ |
39
|
|
|
return [ |
40
|
|
|
ObjectStorageCluster::FIELD_ID, |
41
|
|
|
ObjectStorageCluster::FIELD_DOMAIN, |
42
|
|
|
ObjectStorageCluster::FIELD_STATUS, |
43
|
|
|
ObjectStorageCluster::FIELD_REGION, |
44
|
|
|
ObjectStorageCluster::FIELD_STATIC_SITE_DOMAIN, |
45
|
|
|
]; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
protected function jsonToEntity(array $json): Entity |
49
|
|
|
{ |
50
|
|
|
return new ObjectStorageCluster($this->client, $json); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|