1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Endpoints; |
4
|
|
|
|
5
|
|
|
use AcquiaCloudApi\Connector\ClientInterface; |
6
|
|
|
use AcquiaCloudApi\Response\OperationResponse; |
7
|
|
|
use AcquiaCloudApi\Response\ServersResponse; |
8
|
|
|
use AcquiaCloudApi\Response\ServerResponse; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class Servers |
12
|
|
|
* @package AcquiaCloudApi\CloudApi |
13
|
|
|
*/ |
14
|
|
|
class Servers extends CloudApiBase implements CloudApiInterface |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Gets information about a single server. |
19
|
|
|
* |
20
|
|
|
* @param string $environmentUuid |
21
|
|
|
* @param string $serverId |
22
|
|
|
* @return ServerResponse |
23
|
|
|
*/ |
24
|
|
|
public function get($environmentUuid, $serverId) |
25
|
|
|
{ |
26
|
|
|
return new ServerResponse( |
27
|
|
|
$this->client->request( |
|
|
|
|
28
|
|
|
'get', |
29
|
|
|
"/environments/${environmentUuid}/servers/${serverId}" |
30
|
|
|
) |
31
|
|
|
); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Modifies configuration settings for a server. |
36
|
|
|
* |
37
|
|
|
* @param string $environmentUuid |
38
|
|
|
* @param string $serverId |
39
|
|
|
* @param array $config |
40
|
|
|
* @return OperationResponse |
41
|
|
|
*/ |
42
|
|
|
public function update($environmentUuid, $serverId, array $config) |
43
|
|
|
{ |
44
|
|
|
|
45
|
|
|
return new OperationResponse( |
46
|
|
|
$this->client->request( |
|
|
|
|
47
|
|
|
'put', |
48
|
|
|
"/environments/${environmentUuid}/servers/${serverId}", |
49
|
|
|
$config |
50
|
|
|
) |
51
|
|
|
); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Show all servers associated with an environment. |
56
|
|
|
* |
57
|
|
|
* @param string $environmentUuid |
58
|
|
|
* @return ServersResponse |
59
|
|
|
*/ |
60
|
|
|
public function getAll($environmentUuid) |
61
|
|
|
{ |
62
|
|
|
return new ServersResponse( |
63
|
|
|
$this->client->request( |
|
|
|
|
64
|
|
|
'get', |
65
|
|
|
"/environments/${environmentUuid}/servers" |
66
|
|
|
) |
67
|
|
|
); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|