1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OpenStack\Networking\v2\Extensions\Layer3\Models; |
4
|
|
|
|
5
|
|
|
use OpenStack\Common\Resource\Alias; |
6
|
|
|
use OpenStack\Common\Resource\HasWaiterTrait; |
7
|
|
|
use OpenStack\Common\Resource\OperatorResource; |
8
|
|
|
use OpenStack\Common\Resource\Creatable; |
9
|
|
|
use OpenStack\Common\Resource\Deletable; |
10
|
|
|
use OpenStack\Common\Resource\Listable; |
11
|
|
|
use OpenStack\Common\Resource\Retrievable; |
12
|
|
|
use OpenStack\Common\Resource\Updateable; |
13
|
|
|
use OpenStack\Networking\v2\Extensions\Layer3\Api; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @property Api $api |
17
|
|
|
*/ |
18
|
|
|
class Router extends OperatorResource implements Listable, Creatable, Retrievable, Updateable, Deletable |
19
|
|
|
{ |
20
|
|
|
use HasWaiterTrait; |
21
|
|
|
|
22
|
|
|
/** @var string */ |
23
|
|
|
public $status; |
24
|
|
|
|
25
|
|
|
/** @var GatewayInfo */ |
26
|
|
|
public $externalGatewayInfo; |
27
|
|
|
|
28
|
|
|
/** @var string */ |
29
|
|
|
public $name; |
30
|
|
|
|
31
|
|
|
/** @var string */ |
32
|
|
|
public $adminStateUp; |
33
|
|
|
|
34
|
|
|
/** @var string */ |
35
|
|
|
public $tenantId; |
36
|
|
|
|
37
|
|
|
/** @var array */ |
38
|
|
|
public $routes; |
39
|
|
|
|
40
|
|
|
/** @var string */ |
41
|
|
|
public $id; |
42
|
|
|
|
43
|
|
|
protected $resourceKey = 'router'; |
44
|
|
|
|
45
|
|
|
protected $aliases = [ |
46
|
|
|
'admin_state_up' => 'adminStateUp', |
47
|
|
|
'tenant_id' => 'tenantId', |
48
|
|
|
]; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @inheritdoc |
52
|
|
|
*/ |
53
|
|
|
protected function getAliases(): array |
54
|
|
|
{ |
55
|
|
|
return parent::getAliases() + [ |
56
|
|
|
'external_gateway_info' => new Alias('externalGatewayInfo', GatewayInfo::class) |
57
|
|
|
]; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function create(array $userOptions): Creatable |
61
|
|
|
{ |
62
|
|
|
$response = $this->execute($this->api->postRouters(), $userOptions); |
63
|
|
|
return $this->populateFromResponse($response); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
public function update() |
67
|
|
|
{ |
68
|
|
|
$response = $this->executeWithState($this->api->putRouter()); |
69
|
|
|
$this->populateFromResponse($response); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
public function retrieve() |
73
|
|
|
{ |
74
|
|
|
$response = $this->executeWithState($this->api->getRouter()); |
75
|
|
|
$this->populateFromResponse($response); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
public function delete() |
79
|
|
|
{ |
80
|
|
|
$this->executeWithState($this->api->deleteRouter()); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param array $userOptions {@see \OpenStack\Networking\v2\Extensions\Layer3\Api::putAddInterface} |
85
|
|
|
*/ |
86
|
|
|
public function addInterface(array $userOptions) |
87
|
|
|
{ |
88
|
|
|
$userOptions['id'] = $this->id; |
89
|
|
|
$this->execute($this->api->putAddInterface(), $userOptions); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @param array $userOptions {@see \OpenStack\Networking\v2\Extensions\Layer3\Api::putRemoveInterface} |
94
|
|
|
*/ |
95
|
|
|
public function removeInterface(array $userOptions) |
96
|
|
|
{ |
97
|
|
|
$userOptions['id'] = $this->id; |
98
|
|
|
$this->execute($this->api->putRemoveInterface(), $userOptions); |
99
|
|
|
} |
100
|
|
|
} |
101
|
|
|
|