1 | <?php declare(strict_types=1); |
||
19 | class Volume extends OperatorResource implements Creatable, Listable, Updateable, Deletable, Retrievable, HasMetadata |
||
20 | { |
||
21 | use HasWaiterTrait; |
||
22 | |||
23 | /** @var string */ |
||
24 | public $id; |
||
25 | |||
26 | /** @var int */ |
||
27 | public $size; |
||
28 | |||
29 | /** @var string */ |
||
30 | public $status; |
||
31 | |||
32 | /** @var string */ |
||
33 | public $name; |
||
34 | |||
35 | /** @var array */ |
||
36 | public $attachments; |
||
37 | |||
38 | /** @var string */ |
||
39 | public $availabilityZone; |
||
40 | |||
41 | /** @var \DateTimeImmutable */ |
||
42 | public $createdAt; |
||
43 | |||
44 | /** @var string */ |
||
45 | public $description; |
||
46 | |||
47 | /** @var string */ |
||
48 | public $volumeTypeName; |
||
49 | |||
50 | /** @var string */ |
||
51 | public $snapshotId; |
||
52 | |||
53 | /** @var string */ |
||
54 | public $sourceVolumeId; |
||
55 | |||
56 | /** @var string */ |
||
57 | public $tenantId; |
||
58 | |||
59 | /** @var string */ |
||
60 | public $host; |
||
61 | |||
62 | /** @var array */ |
||
63 | public $metadata = []; |
||
64 | |||
65 | protected $resourceKey = 'volume'; |
||
66 | protected $resourcesKey = 'volumes'; |
||
67 | protected $markerKey = 'id'; |
||
68 | |||
69 | protected $aliases = [ |
||
70 | 3 | 'availability_zone' => 'availabilityZone', |
|
71 | 'source_volid' => 'sourceVolumeId', |
||
72 | 3 | 'snapshot_id' => 'snapshotId', |
|
73 | 3 | 'volume_type' => 'volumeTypeName', |
|
74 | 3 | 'os-vol-tenant-attr:tenant_id' => 'tenantId', |
|
75 | 'os-vol-host-attr:host' => 'host' |
||
76 | ]; |
||
77 | 1 | ||
78 | /** |
||
79 | 1 | * @inheritdoc |
|
80 | 1 | */ |
|
81 | protected function getAliases(): array |
||
82 | { |
||
83 | return parent::getAliases() + [ |
||
84 | 'created_at' => new Alias('createdAt', \DateTimeImmutable::class) |
||
85 | ]; |
||
86 | } |
||
87 | |||
88 | 1 | public function populateFromResponse(ResponseInterface $response): self |
|
94 | |||
95 | public function retrieve() |
||
100 | 1 | ||
101 | /** |
||
102 | * @param array $userOptions {@see \OpenStack\BlockStorage\v2\Api::postVolumes} |
||
103 | 1 | * |
|
104 | * @return Creatable |
||
105 | 1 | */ |
|
106 | 1 | public function create(array $userOptions): Creatable |
|
111 | 1 | ||
112 | 1 | public function update() |
|
117 | 1 | ||
118 | 1 | public function delete() |
|
122 | 1 | ||
123 | public function getMetadata(): array |
||
129 | |||
130 | 4 | public function mergeMetadata(array $metadata) |
|
136 | |||
137 | public function resetMetadata(array $metadata) |
||
142 | |||
143 | public function parseMetadata(ResponseInterface $response): array |
||
148 | } |
||
149 |