|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Endpoints; |
|
4
|
|
|
|
|
5
|
|
|
use AcquiaCloudApi\Connector\ClientInterface; |
|
6
|
|
|
use AcquiaCloudApi\Response\EnvironmentResponse; |
|
7
|
|
|
use AcquiaCloudApi\Response\EnvironmentsResponse; |
|
8
|
|
|
use AcquiaCloudApi\Response\LogstreamResponse; |
|
9
|
|
|
use AcquiaCloudApi\Response\LogsResponse; |
|
10
|
|
|
use AcquiaCloudApi\Response\OperationResponse; |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* Class Logs |
|
14
|
|
|
* @package AcquiaCloudApi\CloudApi |
|
15
|
|
|
*/ |
|
16
|
|
|
class Logs extends CloudApiBase implements CloudApiInterface |
|
17
|
|
|
{ |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Returns a list of log files available for download. |
|
21
|
|
|
* |
|
22
|
|
|
* @return LogsResponse |
|
23
|
|
|
*/ |
|
24
|
|
|
public function getAll($environmentUuid) |
|
25
|
|
|
{ |
|
26
|
|
|
return new LogsResponse( |
|
27
|
|
|
$this->client->request('get', "/environments/${environmentUuid}/logs") |
|
|
|
|
|
|
28
|
|
|
); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Downloads a log file. |
|
33
|
|
|
* |
|
34
|
|
|
* @return object |
|
35
|
|
|
*/ |
|
36
|
|
|
public function download($environmentUuid, $logType) |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->client->request('get', "/environments/${environmentUuid}/logs/${logType}"); |
|
|
|
|
|
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Creates a log file snapshot. |
|
43
|
|
|
* |
|
44
|
|
|
* @return OperationResponse |
|
45
|
|
|
*/ |
|
46
|
|
|
public function snapshot($environmentUuid, $logType) |
|
47
|
|
|
{ |
|
48
|
|
|
return new OperationResponse( |
|
49
|
|
|
$this->client->request('post', "/environments/${environmentUuid}/logs/${logType}") |
|
|
|
|
|
|
50
|
|
|
); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Returns logstream WSS stream information. |
|
55
|
|
|
* |
|
56
|
|
|
* @return LogstreamResponse |
|
57
|
|
|
*/ |
|
58
|
|
|
public function stream($environmentUuid) |
|
59
|
|
|
{ |
|
60
|
|
|
return new LogstreamResponse( |
|
61
|
|
|
$this->client->request('get', "/environments/${environmentUuid}/logstream") |
|
|
|
|
|
|
62
|
|
|
); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|