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\Certificate; |
18
|
|
|
use DigitalOceanV2\Api\Domain; |
19
|
|
|
use DigitalOceanV2\Api\DomainRecord; |
20
|
|
|
use DigitalOceanV2\Api\Droplet; |
21
|
|
|
use DigitalOceanV2\Api\FloatingIp; |
22
|
|
|
use DigitalOceanV2\Api\Image; |
23
|
|
|
use DigitalOceanV2\Api\Key; |
24
|
|
|
use DigitalOceanV2\Api\RateLimit; |
25
|
|
|
use DigitalOceanV2\Api\Region; |
26
|
|
|
use DigitalOceanV2\Api\Size; |
27
|
|
|
use DigitalOceanV2\Api\Snapshot; |
28
|
|
|
use DigitalOceanV2\Api\Volume; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @author Antoine Corcy <[email protected]> |
32
|
|
|
* @author Graham Campbell <[email protected]> |
33
|
|
|
*/ |
34
|
|
|
class DigitalOceanV2 |
35
|
|
|
{ |
36
|
|
|
/** |
37
|
|
|
* @var AdapterInterface |
38
|
|
|
*/ |
39
|
|
|
protected $adapter; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param AdapterInterface $adapter |
43
|
|
|
*/ |
44
|
|
|
public function __construct(AdapterInterface $adapter) |
45
|
|
|
{ |
46
|
|
|
$this->adapter = $adapter; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @return Account |
51
|
|
|
*/ |
52
|
|
|
public function account() |
53
|
|
|
{ |
54
|
|
|
return new Account($this->adapter); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return Action |
59
|
|
|
*/ |
60
|
|
|
public function action() |
61
|
|
|
{ |
62
|
|
|
return new Action($this->adapter); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return Certificate |
67
|
|
|
*/ |
68
|
|
|
public function certificate() |
69
|
|
|
{ |
70
|
|
|
return new Certificate($this->adapter); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return Domain |
75
|
|
|
*/ |
76
|
|
|
public function domain() |
77
|
|
|
{ |
78
|
|
|
return new Domain($this->adapter); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return DomainRecord |
83
|
|
|
*/ |
84
|
|
|
public function domainRecord() |
85
|
|
|
{ |
86
|
|
|
return new DomainRecord($this->adapter); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return Droplet |
91
|
|
|
*/ |
92
|
|
|
public function droplet() |
93
|
|
|
{ |
94
|
|
|
return new Droplet($this->adapter); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @return FloatingIp |
99
|
|
|
*/ |
100
|
|
|
public function floatingIp() |
101
|
|
|
{ |
102
|
|
|
return new FloatingIp($this->adapter); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @return Image |
107
|
|
|
*/ |
108
|
|
|
public function image() |
109
|
|
|
{ |
110
|
|
|
return new Image($this->adapter); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* @return Key |
115
|
|
|
*/ |
116
|
|
|
public function key() |
117
|
|
|
{ |
118
|
|
|
return new Key($this->adapter); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* @return RateLimit |
123
|
|
|
*/ |
124
|
|
|
public function rateLimit() |
125
|
|
|
{ |
126
|
|
|
return new RateLimit($this->adapter); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @return Region |
131
|
|
|
*/ |
132
|
|
|
public function region() |
133
|
|
|
{ |
134
|
|
|
return new Region($this->adapter); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @return Size |
139
|
|
|
*/ |
140
|
|
|
public function size() |
141
|
|
|
{ |
142
|
|
|
return new Size($this->adapter); |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @return Volume |
147
|
|
|
*/ |
148
|
|
|
public function volume() |
149
|
|
|
{ |
150
|
|
|
return new Volume($this->adapter); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @return Snapshot |
155
|
|
|
*/ |
156
|
|
|
public function snapshot() |
157
|
|
|
{ |
158
|
|
|
return new Snapshot($this->adapter); |
159
|
|
|
} |
160
|
|
|
} |
161
|
|
|
|