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