|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace OpenStack\Identity\v3\Models; |
|
4
|
|
|
|
|
5
|
|
|
use OpenStack\Common\Resource\OperatorResource; |
|
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\Identity\v3\Api $api |
|
14
|
|
|
*/ |
|
15
|
|
|
class Policy extends OperatorResource implements Creatable, Listable, Retrievable, Updateable, Deletable |
|
16
|
|
|
{ |
|
17
|
|
|
/** @var string */ |
|
18
|
|
|
public $blob; |
|
19
|
|
|
|
|
20
|
|
|
/** @var string */ |
|
21
|
|
|
public $id; |
|
22
|
|
|
|
|
23
|
|
|
/** @var array */ |
|
24
|
|
|
public $links; |
|
25
|
|
|
|
|
26
|
|
|
/** @var string */ |
|
27
|
|
|
public $projectId; |
|
28
|
|
|
|
|
29
|
|
|
/** @var string */ |
|
30
|
|
|
public $type; |
|
31
|
|
|
|
|
32
|
|
|
/** @var string */ |
|
33
|
|
|
public $userId; |
|
34
|
|
|
|
|
35
|
|
|
protected $resourceKey = 'policy'; |
|
36
|
|
|
protected $resourcesKey = 'policies'; |
|
37
|
|
|
|
|
38
|
|
|
protected $aliases = [ |
|
39
|
|
|
'project_id' => 'projectId', |
|
40
|
|
|
'user_id' => 'userId' |
|
41
|
|
|
]; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* {@inheritDoc} |
|
45
|
2 |
|
* |
|
46
|
|
|
* @param array $data {@see \OpenStack\Identity\v3\Api::postPolicies} |
|
47
|
2 |
|
*/ |
|
48
|
2 |
|
public function create(array $data): Creatable |
|
49
|
|
|
{ |
|
50
|
|
|
$response = $this->execute($this->api->postPolicies(), $data); |
|
51
|
|
|
return $this->populateFromResponse($response); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
1 |
|
/** |
|
55
|
|
|
* {@inheritDoc} |
|
56
|
1 |
|
*/ |
|
57
|
1 |
|
public function retrieve() |
|
58
|
|
|
{ |
|
59
|
|
|
$response = $this->execute($this->api->getPolicy(), ['id' => $this->id]); |
|
60
|
|
|
$this->populateFromResponse($response); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
1 |
|
/** |
|
64
|
|
|
* {@inheritDoc} |
|
65
|
1 |
|
*/ |
|
66
|
1 |
|
public function update() |
|
67
|
|
|
{ |
|
68
|
|
|
$response = $this->executeWithState($this->api->patchPolicy()); |
|
69
|
|
|
$this->populateFromResponse($response); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
1 |
|
/** |
|
73
|
|
|
* {@inheritDoc} |
|
74
|
1 |
|
*/ |
|
75
|
1 |
|
public function delete() |
|
76
|
|
|
{ |
|
77
|
|
|
$this->execute($this->api->deletePolicy(), ['id' => $this->id]); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|