Passed
Push — master ( 851c5d...3501a4 )
by Artem
01:43
created

ObjectStorageCluster::__get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
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;
13
14
use Linode\Entity;
15
use Linode\ObjectStorage\Repository\ObjectStorageBucketRepository;
16
17
/**
18
 * An Object Storage Cluster.
19
 *
20
 * @property string                                 $id                 The unique ID for this cluster.
21
 * @property string                                 $domain             The base URL for this cluster, used for connecting with third-party clients.
22
 * @property string                                 $status             This cluster's status.
23
 * @property string                                 $region             The region where this cluster is located.
24
 * @property string                                 $static_site_domain The base URL for this cluster used when hosting static sites.
25
 * @property ObjectStorageBucketRepositoryInterface $buckets            Storage buckets.
26
 */
27
class ObjectStorageCluster extends Entity
28
{
29
    // Available fields.
30
    public const FIELD_ID                 = 'id';
31
    public const FIELD_DOMAIN             = 'domain';
32
    public const FIELD_STATUS             = 'status';
33
    public const FIELD_REGION             = 'region';
34
    public const FIELD_STATIC_SITE_DOMAIN = 'static_site_domain';
35
36
    // `FIELD_STATUS` values.
37
    public const STATUS_AVAILABLE   = 'available';
38
    public const STATUS_UNAVAILABLE = 'unavailable';
39
40
    /**
41
     * @codeCoverageIgnore This method was autogenerated.
42
     */
43
    public function __get(string $name): mixed
44
    {
45
        return match ($name) {
46
            'buckets' => new ObjectStorageBucketRepository($this->client, $this->id),
47
            default   => parent::__get($name),
48
        };
49
    }
50
}
51