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