GetLogsResponse.php
2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Response.php');
require_once realpath(dirname(__FILE__) . '/QueriedLog.php');
/**
* The response of the GetLog API from log service.
*
* @author log service dev
*/
class Aliyun_Log_Models_GetLogsResponse extends Aliyun_Log_Models_Response {
/**
* @var integer log number
*/
private $count;
/**
* @var string logs query status(Complete or InComplete)
*/
private $progress;
/**
* @var array Aliyun_Log_Models_QueriedLog array, all log data
*/
private $logs;
/**
* Aliyun_Log_Models_GetLogsResponse constructor
*
* @param array $resp
* GetLogs HTTP response body
* @param array $header
* GetLogs HTTP response header
*/
public function __construct($resp, $header) {
parent::__construct ( $header );
$this->count = $header['x-log-count'];
$this->progress = $header ['x-log-progress'];
$this->logs = array ();
foreach ( $resp as $data ) {
$contents = $data;
$time = $data ['__time__'];
$source = $data ['__source__'];
unset ( $contents ['__time__'] );
unset ( $contents ['__source__'] );
$this->logs [] = new Aliyun_Log_Models_QueriedLog ( $time, $source, $contents );
}
}
/**
* Get log number from the response
*
* @return integer log number
*/
public function getCount() {
return $this->count;
}
/**
* Check if the get logs query is completed
*
* @return bool true if this logs query is completed
*/
public function isCompleted() {
return $this->progress == 'Complete';
}
/**
* Get all logs from the response
*
* @return array Aliyun_Log_Models_QueriedLog array, all log data
*/
public function getLogs() {
return $this->logs;
}
}