1 | <?php declare(strict_types=1); |
||
20 | class Snapshot extends OperatorResource implements Listable, Creatable, Updateable, Deletable, Retrievable, HasMetadata |
||
21 | { |
||
22 | use HasWaiterTrait; |
||
23 | |||
24 | /** @var string */ |
||
25 | public $id; |
||
26 | |||
27 | /** @var string */ |
||
28 | public $name; |
||
29 | |||
30 | /** @var string */ |
||
31 | public $status; |
||
32 | |||
33 | /** @var string */ |
||
34 | public $description; |
||
35 | |||
36 | /** @var \DateTimeImmutable */ |
||
37 | public $createdAt; |
||
38 | |||
39 | /** @var array */ |
||
40 | public $metadata = []; |
||
41 | |||
42 | /** @var string */ |
||
43 | public $volumeId; |
||
44 | |||
45 | /** @var int */ |
||
46 | public $size; |
||
47 | |||
48 | protected $resourceKey = 'snapshot'; |
||
49 | protected $resourcesKey = 'snapshots'; |
||
50 | protected $markerKey = 'id'; |
||
51 | |||
52 | protected $aliases = [ |
||
53 | 'volume_id' => 'volumeId', |
||
54 | ]; |
||
55 | |||
56 | 2 | /** |
|
57 | * @inheritdoc |
||
58 | 2 | */ |
|
59 | 2 | protected function getAliases(): array |
|
60 | 2 | { |
|
61 | return parent::getAliases() + [ |
||
62 | 'created_at' => new Alias('createdAt', \DateTimeImmutable::class) |
||
63 | 1 | ]; |
|
64 | } |
||
65 | 1 | ||
66 | 1 | public function populateFromResponse(ResponseInterface $response): self |
|
72 | |||
73 | public function retrieve() |
||
78 | |||
79 | /** |
||
80 | 1 | * @param array $userOptions {@see \OpenStack\BlockStorage\v2\Api::postSnapshots} |
|
81 | * |
||
82 | 1 | * @return Creatable |
|
83 | 1 | */ |
|
84 | public function create(array $userOptions): Creatable |
||
89 | |||
90 | 2 | public function update() |
|
94 | 2 | ||
95 | public function delete() |
||
99 | 1 | ||
100 | 1 | public function getMetadata(): array |
|
106 | 1 | ||
107 | 1 | public function mergeMetadata(array $metadata) |
|
113 | 4 | ||
114 | public function resetMetadata(array $metadata) |
||
119 | |||
120 | public function parseMetadata(ResponseInterface $response): array |
||
125 | } |
||
126 |