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