1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OpenStack\Images\v2\Models; |
4
|
|
|
|
5
|
|
|
use OpenStack\Common\Resource\AbstractResource; |
6
|
|
|
use OpenStack\Common\Resource\Creatable; |
7
|
|
|
use OpenStack\Common\Resource\Deletable; |
8
|
|
|
use OpenStack\Common\Resource\Listable; |
9
|
|
|
use OpenStack\Common\Resource\Retrievable; |
10
|
|
|
use OpenStack\Common\Resource\Updateable; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @property \OpenStack\Images\v2\Api $api |
14
|
|
|
*/ |
15
|
|
|
class Member extends AbstractResource implements Creatable, Listable, Retrievable, Deletable |
16
|
|
|
{ |
17
|
|
|
const STATUS_ACCEPTED = 'accepted'; |
18
|
|
|
const STATUS_PENDING = 'pending'; |
19
|
|
|
const STATUS_REJECTED = 'rejected'; |
20
|
|
|
|
21
|
|
|
/** @var string */ |
22
|
|
|
public $imageId; |
23
|
|
|
|
24
|
|
|
/** @var string */ |
25
|
|
|
public $id; |
26
|
|
|
|
27
|
|
|
/** @var \DateTimeImmutable */ |
28
|
|
|
public $createdAt; |
29
|
|
|
|
30
|
|
|
/** @var \DateTimeImmutable */ |
31
|
|
|
public $updatedAt; |
32
|
|
|
|
33
|
|
|
/** @var string */ |
34
|
|
|
public $schemaUri; |
35
|
|
|
|
36
|
|
|
/** @var string */ |
37
|
|
|
public $status; |
38
|
|
|
|
39
|
|
|
protected $aliases = [ |
40
|
|
|
'created_at' => 'createdAt', |
41
|
|
|
'updated_at' => 'updatedAt', |
42
|
|
|
'member_id' => 'id', |
43
|
|
|
'image_id' => 'imageId', |
44
|
|
|
]; |
45
|
|
|
|
46
|
1 |
|
public function create(array $userOptions) |
47
|
|
|
{ |
48
|
1 |
|
$response = $this->executeWithState($this->api->postImageMembers()); |
49
|
1 |
|
return $this->populateFromResponse($response); |
50
|
|
|
} |
51
|
|
|
|
52
|
1 |
|
public function retrieve() |
53
|
|
|
{ |
54
|
1 |
|
$response = $this->executeWithState($this->api->getImageMember()); |
55
|
1 |
|
$this->populateFromResponse($response); |
56
|
1 |
|
} |
57
|
|
|
|
58
|
1 |
|
public function delete() |
59
|
|
|
{ |
60
|
1 |
|
$this->executeWithState($this->api->deleteImageMember()); |
61
|
1 |
|
} |
62
|
|
|
|
63
|
1 |
|
public function updateStatus($status) |
64
|
|
|
{ |
65
|
1 |
|
$this->status = $status; |
66
|
1 |
|
$this->executeWithState($this->api->putImageMember()); |
67
|
|
|
} |
68
|
|
|
} |