|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace OpenStack\Networking\v2\Extensions\Layer3\Models; |
|
4
|
|
|
|
|
5
|
|
|
use OpenStack\Common\Resource\Alias; |
|
6
|
|
|
use OpenStack\Common\Resource\OperatorResource; |
|
7
|
|
|
use OpenStack\Common\Resource\Creatable; |
|
8
|
|
|
use OpenStack\Common\Resource\Deletable; |
|
9
|
|
|
use OpenStack\Common\Resource\Listable; |
|
10
|
|
|
use OpenStack\Common\Resource\Retrievable; |
|
11
|
|
|
use OpenStack\Common\Resource\Updateable; |
|
12
|
|
|
use OpenStack\Networking\v2\Extensions\Layer3\Api; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @property Api $api |
|
16
|
|
|
*/ |
|
17
|
|
|
class FloatingIp extends OperatorResource implements Listable, Creatable, Retrievable, Updateable, Deletable |
|
18
|
|
|
{ |
|
19
|
|
|
/** @var string */ |
|
20
|
|
|
public $id; |
|
21
|
|
|
|
|
22
|
|
|
/** @var string */ |
|
23
|
|
|
public $status; |
|
24
|
|
|
|
|
25
|
|
|
/** @var string */ |
|
26
|
|
|
public $floatingNetworkId; |
|
27
|
|
|
|
|
28
|
|
|
/** @var string */ |
|
29
|
|
|
public $routerId; |
|
30
|
|
|
|
|
31
|
|
|
/** @var string */ |
|
32
|
|
|
public $fixedIpAddress; |
|
33
|
|
|
|
|
34
|
|
|
/** @var string */ |
|
35
|
|
|
public $floatingIpAddress; |
|
36
|
|
|
|
|
37
|
|
|
/** @var string */ |
|
38
|
|
|
public $tenantId; |
|
39
|
|
|
|
|
40
|
|
|
/** @var string */ |
|
41
|
|
|
public $portId; |
|
42
|
|
|
|
|
43
|
|
|
protected $resourceKey = 'floatingip'; |
|
44
|
|
|
protected $resourcesKey = 'floatingips'; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @inheritdoc |
|
48
|
|
|
*/ |
|
49
|
|
|
protected static function getAlias(): Alias |
|
50
|
|
|
{ |
|
51
|
|
|
$alias = parent::getAlias(); |
|
52
|
|
|
|
|
53
|
|
|
if (!$alias->hasAliases(self::class)) { |
|
54
|
|
|
$alias |
|
55
|
|
|
->add(self::class, 'floating_network_id', 'floatingNetworkId') |
|
56
|
|
|
->add(self::class, 'router_id', 'routerId') |
|
57
|
|
|
->add(self::class, 'fixed_ip_address', 'fixedIpAddress') |
|
58
|
|
|
->add(self::class, 'floating_ip_address', 'floatingIpAddress') |
|
59
|
|
|
->add(self::class, 'tenant_id', 'tenantId') |
|
60
|
|
|
->add(self::class, 'port_id', 'portId'); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
return $alias; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
public function create(array $userOptions): Creatable |
|
67
|
|
|
{ |
|
68
|
|
|
$response = $this->execute($this->api->postFloatingIps(), $userOptions); |
|
69
|
|
|
return $this->populateFromResponse($response); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function update() |
|
73
|
|
|
{ |
|
74
|
|
|
$response = $this->executeWithState($this->api->putFloatingIp()); |
|
75
|
|
|
$this->populateFromResponse($response); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function delete() |
|
79
|
|
|
{ |
|
80
|
|
|
$this->executeWithState($this->api->deleteFloatingIp()); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function retrieve() |
|
84
|
|
|
{ |
|
85
|
|
|
$this->executeWithState($this->api->getFloatingIp()); |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|