1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the DigitalOceanV2 library. |
5
|
|
|
* |
6
|
|
|
* (c) Antoine Corcy <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace DigitalOceanV2; |
13
|
|
|
|
14
|
|
|
use DigitalOceanV2\Adapter\AdapterInterface; |
15
|
|
|
use DigitalOceanV2\Api\Account; |
16
|
|
|
use DigitalOceanV2\Api\Action; |
17
|
|
|
use DigitalOceanV2\Api\Domain; |
18
|
|
|
use DigitalOceanV2\Api\DomainRecord; |
19
|
|
|
use DigitalOceanV2\Api\Droplet; |
20
|
|
|
use DigitalOceanV2\Api\FloatingIp; |
21
|
|
|
use DigitalOceanV2\Api\Image; |
22
|
|
|
use DigitalOceanV2\Api\Key; |
23
|
|
|
use DigitalOceanV2\Api\RateLimit; |
24
|
|
|
use DigitalOceanV2\Api\Region; |
25
|
|
|
use DigitalOceanV2\Api\Size; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @author Antoine Corcy <[email protected]> |
29
|
|
|
* @author Graham Campbell <[email protected]> |
30
|
|
|
*/ |
31
|
|
|
class DigitalOceanV2 |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* @var AdapterInterface |
35
|
|
|
*/ |
36
|
|
|
protected $adapter; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param AdapterInterface $adapter |
40
|
|
|
*/ |
41
|
|
|
public function __construct(AdapterInterface $adapter) |
42
|
|
|
{ |
43
|
|
|
$this->adapter = $adapter; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return Account |
48
|
|
|
*/ |
49
|
|
|
public function account() |
50
|
|
|
{ |
51
|
|
|
return new Account($this->adapter); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @return Action |
56
|
|
|
*/ |
57
|
|
|
public function action() |
58
|
|
|
{ |
59
|
|
|
return new Action($this->adapter); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return Domain |
64
|
|
|
*/ |
65
|
|
|
public function domain() |
66
|
|
|
{ |
67
|
|
|
return new Domain($this->adapter); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @return DomainRecord |
72
|
|
|
*/ |
73
|
|
|
public function domainRecord() |
74
|
|
|
{ |
75
|
|
|
return new DomainRecord($this->adapter); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @return Droplet |
80
|
|
|
*/ |
81
|
|
|
public function droplet() |
82
|
|
|
{ |
83
|
|
|
return new Droplet($this->adapter); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return FloatingIp |
88
|
|
|
*/ |
89
|
|
|
public function floatingIp() |
90
|
|
|
{ |
91
|
|
|
return new FloatingIp($this->adapter); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @return Image |
96
|
|
|
*/ |
97
|
|
|
public function image() |
98
|
|
|
{ |
99
|
|
|
return new Image($this->adapter); |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return Key |
104
|
|
|
*/ |
105
|
|
|
public function key() |
106
|
|
|
{ |
107
|
|
|
return new Key($this->adapter); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return RateLimit |
112
|
|
|
*/ |
113
|
|
|
public function rateLimit() |
114
|
|
|
{ |
115
|
|
|
return new RateLimit($this->adapter); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return Region |
120
|
|
|
*/ |
121
|
|
|
public function region() |
122
|
|
|
{ |
123
|
|
|
return new Region($this->adapter); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @return Size |
128
|
|
|
*/ |
129
|
|
|
public function size() |
130
|
|
|
{ |
131
|
|
|
return new Size($this->adapter); |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|