-
Notifications
You must be signed in to change notification settings - Fork 151
/
Copy pathServiceTrait.php
60 lines (50 loc) · 1.46 KB
/
ServiceTrait.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace OpenStack\Networking\v2\Extensions\Layer3;
use OpenStack\Networking\v2\Extensions\Layer3\Models\FloatingIp;
use OpenStack\Networking\v2\Extensions\Layer3\Models\Router;
/**
* @property \OpenStack\Networking\v2\Api $api
*
* @internal please use the Networking\v2\Service instead of this one
*/
trait ServiceTrait
{
private function floatingIp(array $info = []): FloatingIp
{
return $this->model(FloatingIp::class, $info);
}
private function router(array $info = []): Router
{
return $this->model(Router::class, $info);
}
public function createFloatingIp(array $options): FloatingIp
{
return $this->floatingIp()->create($options);
}
public function getFloatingIp($id): FloatingIp
{
return $this->floatingIp(['id' => $id]);
}
/**
* @return \Generator<mixed, FloatingIp>
*/
public function listFloatingIps(array $options = []): \Generator
{
return $this->floatingIp()->enumerate($this->api->getFloatingIps(), $options);
}
public function createRouter(array $options): Router
{
return $this->router()->create($options);
}
public function getRouter($id): Router
{
return $this->router(['id' => $id]);
}
/**
* @return \Generator<mixed, Router>
*/
public function listRouters(array $options = []): \Generator
{
return $this->router()->enumerate($this->api->getRouters(), $options);
}
}