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
|
|
|
* @param string $environmentUuid |
23
|
|
|
* @return LogsResponse |
24
|
|
|
*/ |
25
|
|
|
public function getAll($environmentUuid) |
26
|
|
|
{ |
27
|
|
|
return new LogsResponse( |
28
|
|
|
$this->client->request('get', "/environments/${environmentUuid}/logs") |
|
|
|
|
29
|
|
|
); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Downloads a log file. |
34
|
|
|
* |
35
|
|
|
* @param string $environmentUuid |
36
|
|
|
* @param string $logType |
37
|
|
|
* @return object |
38
|
|
|
*/ |
39
|
|
|
public function download($environmentUuid, $logType) |
40
|
|
|
{ |
41
|
|
|
return $this->client->request('get', "/environments/${environmentUuid}/logs/${logType}"); |
|
|
|
|
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Creates a log file snapshot. |
46
|
|
|
* |
47
|
|
|
* @param string $environmentUuid |
48
|
|
|
* @param string $logType |
49
|
|
|
* @return OperationResponse |
50
|
|
|
*/ |
51
|
|
|
public function snapshot($environmentUuid, $logType) |
52
|
|
|
{ |
53
|
|
|
return new OperationResponse( |
54
|
|
|
$this->client->request('post', "/environments/${environmentUuid}/logs/${logType}") |
|
|
|
|
55
|
|
|
); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Returns logstream WSS stream information. |
60
|
|
|
* |
61
|
|
|
* @param string $environmentUuid |
62
|
|
|
* @return LogstreamResponse |
63
|
|
|
*/ |
64
|
|
|
public function stream($environmentUuid) |
65
|
|
|
{ |
66
|
|
|
return new LogstreamResponse( |
67
|
|
|
$this->client->request('get', "/environments/${environmentUuid}/logstream") |
|
|
|
|
68
|
|
|
); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|