Commit 97491df7b97fb26f8c48918a3f74f2e41da3493d

Authored by teemitop
1 parent 4807c4fb

阿里云日志抓取

Showing 50 changed files with 4804 additions and 0 deletions

Too many changes to show.

To preserve performance only 50 of 50+ files are displayed.

... ... @@ -53,4 +53,79 @@ class System extends Common
}
}
/**
* 获取日志列表
*/
public function log(){
//基础参数
/* 使用autoloader类自动加载所有需要的PHP模块。注意使用合适的路径指向autoloader类所在文件*/
$DOCUMENT_ROOT = str_replace('public','',$_SERVER['DOCUMENT_ROOT']);
require_once $DOCUMENT_ROOT.'vendor/aliyunlog/Log_Autoload.php';
//require_once realpath(dirname(__FILE__) . '/../Log_Autoload.php');
$endpoint = 'cn-beijing.log.aliyuncs.com'; // 选择与上面步骤创建project所属区域匹配的Endpoint
$accessKeyId = 'LTAI4Fivq9UqCkAnCgDKqMBC'; // 使用你的阿里云访问密钥AccessKeyId
$accessKey = 'AdmOpP2LzbbbY6N9BaGnIE3UBzI62E'; // 使用你的阿里云访问密钥AccessKeySecret
$project = '101-dc-api-log'; // 上面步骤创建的项目名称
$logstore = 'info-log'; // 上面步骤创建的日志库名称
$client = new \Aliyun_Log_Client($endpoint, $accessKeyId, $accessKey);
if(Request::isAjax()) {
$data = Request::except('file');
#查询日志数据
$topic = "";
$total_query_str= '* | select count(1) as count';
$key_query_str = '';
$from = time()-2592000;
$to = time();
$total = NULL;
$key_query = NULL;
while (is_null($total) || (! $total->isCompleted()))
{
$total = new \Aliyun_Log_Models_GetLogsRequest($project, $logstore, $from, $to, $topic, $total_query_str, 0, 0, true);
$total = $client->getLogs($total);
}
while (is_null($key_query) || (! $key_query->isCompleted()))
{
$key_query = new \Aliyun_Log_Models_GetLogsRequest($project, $logstore, $from, $to, $topic, $key_query_str, $data['limit'], $data['page'], true);
$key_query = $client->getLogs($key_query);
}
$result = array();
$count = 0;
try {
foreach($total -> getLogs() as $log)
{
foreach($log -> getContents() as $key => $value){
$count = $value; //总数
}
}
foreach($key_query -> getLogs() as $k=>$v)
{
foreach($v -> getContents() as $key => $value){
$result['list'][$k][$key] = $value;
}
}
} catch (Aliyun_Log_Exception $ex) {
logVarDump($ex);
} catch (Exception $ex) {
logVarDump($ex);
}
return ['code'=>0,'msg'=>'获取成功!','data'=>$result['list'],'count'=>$count,'rel'=>1];
}
return $this->fetch();
}
//PHP stdClass Object转array
public function objectToArray($e){
$e=(array)$e;
foreach($e as $k=>$v){
if( gettype($v)=='resource' ) return;
if( gettype($v)=='object' || gettype($v)=='array' )
$e[$k]=(array)self::objectToArray($v);
}
return $e;
}
}
... ...
{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
<fieldset class="layui-elem-field layui-field-title">
<legend>{:$title}</legend>
</fieldset>
<div class="demoTable">
<!--商家:
<div class="layui-input-inline">
<input class="layui-input" name="key" id="key" placeholder="{:lang('pleaseEnter')}店铺名称" autocomplete="off">
</div>
日期范围:
<div class="layui-input-inline" >
<input type="text" style = "width:300px"; class="layui-input" id="time" placeholder="默认为当天的统计情况">
</div>
商家来源:
<div class="layui-input-inline layui-form">
<div class="layui-input-8">
<select name="class" id="channel" lay-filter="myselect">
<option value="-1">全部</option>
<option value="1" selected>合作</option>
<option value="2">推广</option>
<option value="3">测试</option>
</select>
</div>
</div>
筛选条件:
<div class="layui-input-inline layui-form">
<div class="layui-input-8">
<select name="class" id="time_type" lay-filter="myselect">
<option value="1">录入时间</option>
<option value="2">到店时间</option>
</select>
</div>
</div>-->
<!--地区:
<div class="layui-input-inline">
<input type="text" class="layui-input" id="area" placeholder="地区暂未开放">
</div>
<button class="layui-btn" id="search" data-type="reload">查询统计</button>-->
</div>
<table class="layui-table" id="list" lay-filter="list"></table>
</div>
<script type="text/html" id="toolbarDemo">
</script>
{include file="common/foot"/}
<script>
layui.use(['table','form','laydate'], function() {
var table = layui.table,laydate = layui.laydate,$ = layui.jquery;
console.log(layui);
var tableIn = table.render({
elem: '#list',
url: '{:url("log")}',
method: 'post',
title: '日志记录',
page:true,
toolbar: '#toolbarDemo',
cols: [[
{field: 'parm', align: 'center',title: '内容'},
{field: 'time',width:210, title: '时间'},
]],
done: function(res, curr, count){
//code
}
,id: 'testReload'
,page: true
,limit:15
});
/*//日期时间范围
laydate.render({
elem: '#time'
,type: 'datetime'
,range: true
});
//搜索
$('#search').on('click', function() {
//关键字
var key = $('#key').val();
//选中的商家ID
var checkStatus = table.checkStatus('testReload'); //test即为参数id设定的值
var a = [];
$(checkStatus.data).each(function(i,o){
a.push(o.id);
});
console.log(a);
var time = $('#time').val();
console.log(time);
//商家来源
var channel = $('#channel').val();
console.log(channel);
//筛选条件
var time_type = $('#time_type').val();
console.log(time_type);
//传参
tableIn.reload({ page: {page: 1},where: {key: key,sid: a,time: time,time_type: time_type,channel: channel}});
});
var $ = layui.$, active = {
reload: function(){
var key = $('#key');
//执行重载
table.reload('testReload', {
page: {
curr: 1 //重新从第 1 页开始
}
,where: {
key: {
id: key.val()
}
}
});
}
};*/
})
</script>
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
date_default_timezone_set ( 'Asia/Shanghai' );
require_once realpath ( dirname ( __FILE__ ) . '/../../Log_Autoload.php' );
require_once realpath ( dirname ( __FILE__ ) . '/requestcore.class.php' );
require_once realpath ( dirname ( __FILE__ ) . '/sls.proto.php' );
require_once realpath ( dirname ( __FILE__ ) . '/protocolbuffers.inc.php' );
if(!defined('API_VERSION'))
define('API_VERSION', '0.6.0');
if(!defined('USER_AGENT'))
define('USER_AGENT', 'log-php-sdk-v-0.6.0');
/**
* Aliyun_Log_Client class is the main class in the SDK. It can be used to
* communicate with LOG server to put/get data.
*
* @author log_dev
*/
class Aliyun_Log_Client {
/**
* @var string aliyun accessKey
*/
protected $accessKey;
/**
* @var string aliyun accessKeyId
*/
protected $accessKeyId;
/**
*@var string aliyun sts token
*/
protected $stsToken;
/**
* @var string LOG endpoint
*/
protected $endpoint;
/**
* @var string Check if the host if row ip.
*/
protected $isRowIp;
/**
* @var integer Http send port. The dafault value is 80.
*/
protected $port;
/**
* @var string log sever host.
*/
protected $logHost;
/**
* @var string the local machine ip address.
*/
protected $source;
/**
* Aliyun_Log_Client constructor
*
* @param string $endpoint
* LOG host name, for example, http://cn-hangzhou.sls.aliyuncs.com
* @param string $accessKeyId
* aliyun accessKeyId
* @param string $accessKey
* aliyun accessKey
*/
public function __construct($endpoint, $accessKeyId, $accessKey,$token = "") {
$this->setEndpoint ( $endpoint ); // set $this->logHost
$this->accessKeyId = $accessKeyId;
$this->accessKey = $accessKey;
$this->stsToken = $token;
$this->source = Aliyun_Log_Util::getLocalIp();
}
private function setEndpoint($endpoint) {
$pos = strpos ( $endpoint, "://" );
if ($pos !== false) { // be careful, !==
$pos += 3;
$endpoint = substr ( $endpoint, $pos );
}
$pos = strpos ( $endpoint, "/" );
if ($pos !== false) // be careful, !==
$endpoint = substr ( $endpoint, 0, $pos );
$pos = strpos ( $endpoint, ':' );
if ($pos !== false) { // be careful, !==
$this->port = ( int ) substr ( $endpoint, $pos + 1 );
$endpoint = substr ( $endpoint, 0, $pos );
} else
$this->port = 80;
$this->isRowIp = Aliyun_Log_Util::isIp ( $endpoint );
$this->logHost = $endpoint;
$this->endpoint = $endpoint . ':' . ( string ) $this->port;
}
/**
* GMT format time string.
*
* @return string
*/
protected function getGMT() {
return gmdate ( 'D, d M Y H:i:s' ) . ' GMT';
}
/**
* Decodes a JSON string to a JSON Object.
* Unsuccessful decode will cause an Aliyun_Log_Exception.
*
* @return string
* @throws Aliyun_Log_Exception
*/
protected function parseToJson($resBody, $requestId) {
if (! $resBody)
return NULL;
$result = json_decode ( $resBody, true );
if ($result === NULL){
throw new Aliyun_Log_Exception ( 'BadResponse', "Bad format,not json: $resBody", $requestId );
}
return $result;
}
/**
* @return array
*/
protected function getHttpResponse($method, $url, $body, $headers) {
$request = new RequestCore ( $url );
foreach ( $headers as $key => $value )
$request->add_header ( $key, $value );
$request->set_method ( $method );
$request->set_useragent(USER_AGENT);
if ($method == "POST" || $method == "PUT")
$request->set_body ( $body );
$request->send_request ();
$response = array ();
$response [] = ( int ) $request->get_response_code ();
$response [] = $request->get_response_header ();
$response [] = $request->get_response_body ();
return $response;
}
/**
* @return array
* @throws Aliyun_Log_Exception
*/
private function sendRequest($method, $url, $body, $headers) {
try {
list ( $responseCode, $header, $resBody ) =
$this->getHttpResponse ( $method, $url, $body, $headers );
} catch ( Exception $ex ) {
throw new Aliyun_Log_Exception ( $ex->getMessage (), $ex->__toString () );
}
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
if ($responseCode == 200) {
return array ($resBody,$header);
}
else {
$exJson = $this->parseToJson ( $resBody, $requestId );
if (isset($exJson ['error_code']) && isset($exJson ['error_message'])) {
throw new Aliyun_Log_Exception ( $exJson ['error_code'],
$exJson ['error_message'], $requestId );
} else {
if ($exJson) {
$exJson = ' The return json is ' . json_encode($exJson);
} else {
$exJson = '';
}
throw new Aliyun_Log_Exception ( 'RequestError',
"Request is failed. Http code is $responseCode.$exJson", $requestId );
}
}
}
/**
* @return array
* @throws Aliyun_Log_Exception
*/
private function send($method, $project, $body, $resource, $params, $headers) {
if ($body) {
$headers ['Content-Length'] = strlen ( $body );
if(isset($headers ["x-log-bodyrawsize"])==false)
$headers ["x-log-bodyrawsize"] = 0;
$headers ['Content-MD5'] = Aliyun_Log_Util::calMD5 ( $body );
} else {
$headers ['Content-Length'] = 0;
$headers ["x-log-bodyrawsize"] = 0;
$headers ['Content-Type'] = ''; // If not set, http request will add automatically.
}
$headers ['x-log-apiversion'] = API_VERSION;
$headers ['x-log-signaturemethod'] = 'hmac-sha1';
if(strlen($this->stsToken) >0)
$headers ['x-acs-security-token'] = $this -> stsToken;
if(is_null($project))$headers ['Host'] = $this->logHost;
else $headers ['Host'] = "$project.$this->logHost";
$headers ['Date'] = $this->GetGMT ();
$signature = Aliyun_Log_Util::getRequestAuthorization ( $method, $resource, $this->accessKey,$this->stsToken, $params, $headers );
$headers ['Authorization'] = "LOG $this->accessKeyId:$signature";
$url = $resource;
if ($params)
$url .= '?' . Aliyun_Log_Util::urlEncode ( $params );
if ($this->isRowIp)
$url = "http://$this->endpoint$url";
else{
if(is_null($project))
$url = "http://$this->endpoint$url";
else $url = "http://$project.$this->endpoint$url";
}
return $this->sendRequest ( $method, $url, $body, $headers );
}
/**
* Put logs to Log Service.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_PutLogsRequest $request the PutLogs request parameters class
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_PutLogsResponse
*/
public function putLogs(Aliyun_Log_Models_PutLogsRequest $request) {
if (count ( $request->getLogitems () ) > 4096)
throw new Aliyun_Log_Exception ( 'InvalidLogSize', "logItems' length exceeds maximum limitation: 4096 lines." );
$logGroup = new LogGroup ();
$topic = $request->getTopic () !== null ? $request->getTopic () : '';
$logGroup->setTopic ( $request->getTopic () );
$source = $request->getSource ();
if ( ! $source )
$source = $this->source;
$logGroup->setSource ( $source );
$logitems = $request->getLogitems ();
foreach ( $logitems as $logItem ) {
$log = new Log ();
$log->setTime ( $logItem->getTime () );
$content = $logItem->getContents ();
foreach ( $content as $key => $value ) {
$content = new Log_Content ();
$content->setKey ( $key );
$content->setValue ( $value );
$log->addContents ( $content );
}
$logGroup->addLogs ( $log );
}
$body = Aliyun_Log_Util::toBytes( $logGroup );
unset ( $logGroup );
$bodySize = strlen ( $body );
if ($bodySize > 3 * 1024 * 1024) // 3 MB
throw new Aliyun_Log_Exception ( 'InvalidLogSize', "logItems' size exceeds maximum limitation: 3 MB." );
$params = array ();
$headers = array ();
$headers ["x-log-bodyrawsize"] = $bodySize;
$headers ['x-log-compresstype'] = 'deflate';
$headers ['Content-Type'] = 'application/x-protobuf';
$body = gzcompress ( $body, 6 );
$logstore = $request->getLogstore () !== null ? $request->getLogstore () : '';
$project = $request->getProject () !== null ? $request->getProject () : '';
$shardKey = $request -> getShardKey();
$resource = "/logstores/" . $logstore.($shardKey== null?"/shards/lb":"/shards/route");
if($shardKey)
$params["key"]=$shardKey;
list ( $resp, $header ) = $this->send ( "POST", $project, $body, $resource, $params, $headers );
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_PutLogsResponse ( $header );
}
/**
* create shipper service
* @param Aliyun_Log_Models_CreateShipperRequest $request
* return Aliyun_Log_Models_CreateShipperResponse
*/
public function createShipper(Aliyun_Log_Models_CreateShipperRequest $request){
$headers = array();
$params = array();
$resource = "/logstores/".$request->getLogStore()."/shipper";
$project = $request->getProject () !== null ? $request->getProject () : '';
$headers["Content-Type"] = "application/json";
$body = array(
"shipperName" => $request->getShipperName(),
"targetType" => $request->getTargetType(),
"targetConfiguration" => $request->getTargetConfigration()
);
$body_str = json_encode($body);
$headers["x-log-bodyrawsize"] = strlen($body_str);
list($resp, $header) = $this->send("POST", $project,$body_str,$resource,$params,$headers);
$requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson($resp, $requestId);
return new Aliyun_Log_Models_CreateShipperResponse($resp, $header);
}
/**
* create shipper service
* @param Aliyun_Log_Models_UpdateShipperRequest $request
* return Aliyun_Log_Models_UpdateShipperResponse
*/
public function updateShipper(Aliyun_Log_Models_UpdateShipperRequest $request){
$headers = array();
$params = array();
$resource = "/logstores/".$request->getLogStore()."/shipper/".$request->getShipperName();
$project = $request->getProject () !== null ? $request->getProject () : '';
$headers["Content-Type"] = "application/json";
$body = array(
"shipperName" => $request->getShipperName(),
"targetType" => $request->getTargetType(),
"targetConfiguration" => $request->getTargetConfigration()
);
$body_str = json_encode($body);
$headers["x-log-bodyrawsize"] = strlen($body_str);
list($resp, $header) = $this->send("PUT", $project,$body_str,$resource,$params,$headers);
$requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson($resp, $requestId);
return new Aliyun_Log_Models_UpdateShipperResponse($resp, $header);
}
/**
* get shipper tasks list, max 48 hours duration supported
* @param Aliyun_Log_Models_GetShipperTasksRequest $request
* return Aliyun_Log_Models_GetShipperTasksResponse
*/
public function getShipperTasks(Aliyun_Log_Models_GetShipperTasksRequest $request){
$headers = array();
$params = array(
'from' => $request->getStartTime(),
'to' => $request->getEndTime(),
'status' => $request->getStatusType(),
'offset' => $request->getOffset(),
'size' => $request->getSize()
);
$resource = "/logstores/".$request->getLogStore()."/shipper/".$request->getShipperName()."/tasks";
$project = $request->getProject () !== null ? $request->getProject () : '';
$headers["x-log-bodyrawsize"] = 0;
$headers["Content-Type"] = "application/json";
list($resp, $header) = $this->send("GET", $project,null,$resource,$params,$headers);
$requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson($resp, $requestId);
return new Aliyun_Log_Models_GetShipperTasksResponse($resp, $header);
}
/**
* retry shipper tasks list by task ids
* @param Aliyun_Log_Models_RetryShipperTasksRequest $request
* return Aliyun_Log_Models_RetryShipperTasksResponse
*/
public function retryShipperTasks(Aliyun_Log_Models_RetryShipperTasksRequest $request){
$headers = array();
$params = array();
$resource = "/logstores/".$request->getLogStore()."/shipper/".$request->getShipperName()."/tasks";
$project = $request->getProject () !== null ? $request->getProject () : '';
$headers["Content-Type"] = "application/json";
$body = $request->getTaskLists();
$body_str = json_encode($body);
$headers["x-log-bodyrawsize"] = strlen($body_str);
list($resp, $header) = $this->send("PUT", $project,$body_str,$resource,$params,$headers);
$requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson($resp, $requestId);
return new Aliyun_Log_Models_RetryShipperTasksResponse($resp, $header);
}
/**
* delete shipper service
* @param Aliyun_Log_Models_DeleteShipperRequest $request
* return Aliyun_Log_Models_DeleteShipperResponse
*/
public function deleteShipper(Aliyun_Log_Models_DeleteShipperRequest $request){
$headers = array();
$params = array();
$resource = "/logstores/".$request->getLogStore()."/shipper/".$request->getShipperName();
$project = $request->getProject () !== null ? $request->getProject () : '';
$headers["x-log-bodyrawsize"] = 0;
$headers["Content-Type"] = "application/json";
list($resp, $header) = $this->send("DELETE", $project,null,$resource,$params,$headers);
$requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson($resp, $requestId);
return new Aliyun_Log_Models_DeleteShipperResponse($resp, $header);
}
/**
* get shipper config service
* @param Aliyun_Log_Models_GetShipperConfigRequest $request
* return Aliyun_Log_Models_GetShipperConfigResponse
*/
public function getShipperConfig(Aliyun_Log_Models_GetShipperConfigRequest $request){
$headers = array();
$params = array();
$resource = "/logstores/".$request->getLogStore()."/shipper/".$request->getShipperName();
$project = $request->getProject () !== null ? $request->getProject () : '';
$headers["x-log-bodyrawsize"] = 0;
$headers["Content-Type"] = "application/json";
list($resp, $header) = $this->send("GET", $project,null,$resource,$params,$headers);
$requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson($resp, $requestId);
return new Aliyun_Log_Models_GetShipperConfigResponse($resp, $header);
}
/**
* list shipper service
* @param Aliyun_Log_Models_ListShipperRequest $request
* return Aliyun_Log_Models_ListShipperResponse
*/
public function listShipper(Aliyun_Log_Models_ListShipperRequest $request){
$headers = array();
$params = array();
$resource = "/logstores/".$request->getLogStore()."/shipper";
$project = $request->getProject () !== null ? $request->getProject () : '';
$headers["x-log-bodyrawsize"] = 0;
$headers["Content-Type"] = "application/json";
list($resp, $header) = $this->send("GET", $project,null,$resource,$params,$headers);
$requestId = isset($header['x-log-requestid']) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson($resp, $requestId);
return new Aliyun_Log_Models_ListShipperResponse($resp, $header);
}
/**
* create logstore
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_CreateLogstoreRequest $request the CreateLogStore request parameters class.
* @throws Aliyun_Log_Exception
* return Aliyun_Log_Models_CreateLogstoreResponse
*/
public function createLogstore(Aliyun_Log_Models_CreateLogstoreRequest $request){
$headers = array ();
$params = array ();
$resource = '/logstores';
$project = $request->getProject () !== null ? $request->getProject () : '';
$headers["x-log-bodyrawsize"] = 0;
$headers["Content-Type"] = "application/json";
$body = array(
"logstoreName" => $request -> getLogstore(),
"ttl" => (int)($request -> getTtl()),
"shardCount" => (int)($request -> getShardCount())
);
$body_str = json_encode($body);
$headers["x-log-bodyrawsize"] = strlen($body_str);
list($resp,$header) = $this -> send("POST",$project,$body_str,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_CreateLogstoreResponse($resp,$header);
}
/**
* update logstore
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_UpdateLogstoreRequest $request the UpdateLogStore request parameters class.
* @throws Aliyun_Log_Exception
* return Aliyun_Log_Models_UpdateLogstoreResponse
*/
public function updateLogstore(Aliyun_Log_Models_UpdateLogstoreRequest $request){
$headers = array ();
$params = array ();
$project = $request->getProject () !== null ? $request->getProject () : '';
$headers["Content-Type"] = "application/json";
$body = array(
"logstoreName" => $request -> getLogstore(),
"ttl" => (int)($request -> getTtl()),
"shardCount" => (int)($request -> getShardCount())
);
$resource = '/logstores/'.$request -> getLogstore();
$body_str = json_encode($body);
$headers["x-log-bodyrawsize"] = strlen($body_str);
list($resp,$header) = $this -> send("PUT",$project,$body_str,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_UpdateLogstoreResponse($resp,$header);
}
/**
* List all logstores of requested project.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_ListLogstoresRequest $request the ListLogstores request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_ListLogstoresResponse
*/
public function listLogstores(Aliyun_Log_Models_ListLogstoresRequest $request) {
$headers = array ();
$params = array ();
$resource = '/logstores';
$project = $request->getProject () !== null ? $request->getProject () : '';
list ( $resp, $header ) = $this->send ( "GET", $project, NULL, $resource, $params, $headers );
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_ListLogstoresResponse ( $resp, $header );
}
/**
* Delete logstore
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_DeleteLogstoreRequest $request the DeleteLogstores request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_DeleteLogstoresResponse
*/
public function deleteLogstore(Aliyun_Log_Models_DeleteLogstoreRequest $request) {
$headers = array ();
$params = array ();
$project = $request->getProject () !== null ? $request->getProject () : '';
$logstore = $request -> getLogstore() != null ? $request -> getLogstore() :"";
$resource = "/logstores/$logstore";
list ( $resp, $header ) = $this->send ( "DELETE", $project, NULL, $resource, $params, $headers );
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_DeleteLogstoreResponse ( $resp, $header );
}
/**
* List all topics in a logstore.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_ListTopicsRequest $request the ListTopics request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_ListTopicsResponse
*/
public function listTopics(Aliyun_Log_Models_ListTopicsRequest $request) {
$headers = array ();
$params = array ();
if ($request->getToken () !== null)
$params ['token'] = $request->getToken ();
if ($request->getLine () !== null)
$params ['line'] = $request->getLine ();
$params ['type'] = 'topic';
$logstore = $request->getLogstore () !== null ? $request->getLogstore () : '';
$project = $request->getProject () !== null ? $request->getProject () : '';
$resource = "/logstores/$logstore";
list ( $resp, $header ) = $this->send ( "GET", $project, NULL, $resource, $params, $headers );
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_ListTopicsResponse ( $resp, $header );
}
/**
* Get histograms of requested query from log service.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_GetHistogramsRequest $request the GetHistograms request parameters class.
* @throws Aliyun_Log_Exception
* @return array(json body, http header)
*/
public function getHistogramsJson(Aliyun_Log_Models_GetHistogramsRequest $request) {
$headers = array ();
$params = array ();
if ($request->getTopic () !== null)
$params ['topic'] = $request->getTopic ();
if ($request->getFrom () !== null)
$params ['from'] = $request->getFrom ();
if ($request->getTo () !== null)
$params ['to'] = $request->getTo ();
if ($request->getQuery () !== null)
$params ['query'] = $request->getQuery ();
$params ['type'] = 'histogram';
$logstore = $request->getLogstore () !== null ? $request->getLogstore () : '';
$project = $request->getProject () !== null ? $request->getProject () : '';
$resource = "/logstores/$logstore";
list ( $resp, $header ) = $this->send ( "GET", $project, NULL, $resource, $params, $headers );
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return array($resp, $header);
}
/**
* Get histograms of requested query from log service.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_GetHistogramsRequest $request the GetHistograms request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_GetHistogramsResponse
*/
public function getHistograms(Aliyun_Log_Models_GetHistogramsRequest $request) {
$ret = $this->getHistogramsJson($request);
$resp = $ret[0];
$header = $ret[1];
return new Aliyun_Log_Models_GetHistogramsResponse ( $resp, $header );
}
/**
* Get logs from Log service.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_GetLogsRequest $request the GetLogs request parameters class.
* @throws Aliyun_Log_Exception
* @return array(json body, http header)
*/
public function getLogsJson(Aliyun_Log_Models_GetLogsRequest $request) {
$headers = array ();
$params = array ();
if ($request->getTopic () !== null)
$params ['topic'] = $request->getTopic ();
if ($request->getFrom () !== null)
$params ['from'] = $request->getFrom ();
if ($request->getTo () !== null)
$params ['to'] = $request->getTo ();
if ($request->getQuery () !== null)
$params ['query'] = $request->getQuery ();
$params ['type'] = 'log';
if ($request->getLine () !== null)
$params ['line'] = $request->getLine ();
if ($request->getOffset () !== null)
$params ['offset'] = $request->getOffset ();
if ($request->getOffset () !== null)
$params ['reverse'] = $request->getReverse () ? 'true' : 'false';
$logstore = $request->getLogstore () !== null ? $request->getLogstore () : '';
$project = $request->getProject () !== null ? $request->getProject () : '';
$resource = "/logstores/$logstore";
list ( $resp, $header ) = $this->send ( "GET", $project, NULL, $resource, $params, $headers );
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return array($resp, $header);
//return new Aliyun_Log_Models_GetLogsResponse ( $resp, $header );
}
/**
* Get logs from Log service.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_GetLogsRequest $request the GetLogs request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_GetLogsResponse
*/
public function getLogs(Aliyun_Log_Models_GetLogsRequest $request) {
$ret = $this->getLogsJson($request);
$resp = $ret[0];
$header = $ret[1];
return new Aliyun_Log_Models_GetLogsResponse ( $resp, $header );
}
/**
* Get logs from Log service.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_GetProjectLogsRequest $request the GetLogs request parameters class.
* @throws Aliyun_Log_Exception
* @return array(json body, http header)
*/
public function getProjectLogsJson(Aliyun_Log_Models_GetProjectLogsRequest $request) {
$headers = array ();
$params = array ();
if ($request->getQuery () !== null)
$params ['query'] = $request->getQuery ();
$project = $request->getProject () !== null ? $request->getProject () : '';
$resource = "/logs";
list ( $resp, $header ) = $this->send ( "GET", $project, NULL, $resource, $params, $headers );
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return array($resp, $header);
//return new Aliyun_Log_Models_GetLogsResponse ( $resp, $header );
}
/**
* Get logs from Log service.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_GetProjectLogsRequest $request the GetLogs request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_GetLogsResponse
*/
public function getProjectLogs(Aliyun_Log_Models_GetProjectLogsRequest $request) {
$ret = $this->getProjectLogsJson($request);
$resp = $ret[0];
$header = $ret[1];
return new Aliyun_Log_Models_GetLogsResponse ( $resp, $header );
}
/**
* Get logs from Log service with shardid conditions.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_BatchGetLogsRequest $request the BatchGetLogs request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_BatchGetLogsResponse
*/
public function batchGetLogs(Aliyun_Log_Models_BatchGetLogsRequest $request) {
$params = array();
$headers = array();
$project = $request->getProject()!==null?$request->getProject():'';
$logstore = $request->getLogstore()!==null?$request->getLogstore():'';
$shardId = $request->getShardId()!==null?$request->getShardId():'';
if($request->getCount()!==null)
$params['count']=$request->getCount();
if($request->getCursor()!==null)
$params['cursor']=$request->getCursor();
if($request->getEndCursor()!==null)
$params['end_cursor']=$request->getEndCursor();
$params['type']='log';
$headers['Accept-Encoding']='gzip';
$headers['accept']='application/x-protobuf';
$resource = "/logstores/$logstore/shards/$shardId";
list($resp,$header) = $this->send("GET",$project,NULL,$resource,$params,$headers);
//$resp is a byteArray
$resp = gzuncompress($resp);
if($resp===false)$resp = new LogGroupList();
else {
$resp = new LogGroupList($resp);
}
return new Aliyun_Log_Models_BatchGetLogsResponse ( $resp, $header );
}
/**
* List Shards from Log service with Project and logstore conditions.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_ListShardsRequest $request the ListShards request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_ListShardsResponse
*/
public function listShards(Aliyun_Log_Models_ListShardsRequest $request) {
$params = array();
$headers = array();
$project = $request->getProject()!==null?$request->getProject():'';
$logstore = $request->getLogstore()!==null?$request->getLogstore():'';
$resource='/logstores/'.$logstore.'/shards';
list($resp,$header) = $this->send("GET",$project,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_ListShardsResponse ( $resp, $header );
}
/**
* split a shard into two shards with Project and logstore and shardId and midHash conditions.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_SplitShardRequest $request the SplitShard request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_ListShardsResponse
*/
public function splitShard(Aliyun_Log_Models_SplitShardRequest $request) {
$params = array();
$headers = array();
$project = $request->getProject()!==null?$request->getProject():'';
$logstore = $request->getLogstore()!==null?$request->getLogstore():'';
$shardId = $request -> getShardId()!== null ? $request -> getShardId():-1;
$midHash = $request -> getMidHash()!= null?$request -> getMidHash():"";
$resource='/logstores/'.$logstore.'/shards/'.$shardId;
$params["action"] = "split";
$params["key"] = $midHash;
list($resp,$header) = $this->send("POST",$project,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_ListShardsResponse ( $resp, $header );
}
/**
* merge two shards into one shard with Project and logstore and shardId and conditions.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_MergeShardsRequest $request the MergeShards request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_ListShardsResponse
*/
public function MergeShards(Aliyun_Log_Models_MergeShardsRequest $request) {
$params = array();
$headers = array();
$project = $request->getProject()!==null?$request->getProject():'';
$logstore = $request->getLogstore()!==null?$request->getLogstore():'';
$shardId = $request -> getShardId()!= null ? $request -> getShardId():-1;
$resource='/logstores/'.$logstore.'/shards/'.$shardId;
$params["action"] = "merge";
list($resp,$header) = $this->send("POST",$project,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_ListShardsResponse ( $resp, $header );
}
/**
* delete a read only shard with Project and logstore and shardId conditions.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_DeleteShardRequest $request the DeleteShard request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_ListShardsResponse
*/
public function DeleteShard(Aliyun_Log_Models_DeleteShardRequest $request) {
$params = array();
$headers = array();
$project = $request->getProject()!==null?$request->getProject():'';
$logstore = $request->getLogstore()!==null?$request->getLogstore():'';
$shardId = $request -> getShardId()!= null ? $request -> getShardId():-1;
$resource='/logstores/'.$logstore.'/shards/'.$shardId;
list($resp,$header) = $this->send("DELETE",$project,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
return new Aliyun_Log_Models_DeleteShardResponse ( $header );
}
/**
* Get cursor from Log service.
* Unsuccessful opertaion will cause an Aliyun_Log_Exception.
*
* @param Aliyun_Log_Models_GetCursorRequest $request the GetCursor request parameters class.
* @throws Aliyun_Log_Exception
* @return Aliyun_Log_Models_GetCursorResponse
*/
public function getCursor(Aliyun_Log_Models_GetCursorRequest $request){
$params = array();
$headers = array();
$project = $request->getProject()!==null?$request->getProject():'';
$logstore = $request->getLogstore()!==null?$request->getLogstore():'';
$shardId = $request->getShardId()!==null?$request->getShardId():'';
$mode = $request->getMode()!==null?$request->getMode():'';
$fromTime = $request->getFromTime()!==null?$request->getFromTime():-1;
if((empty($mode) xor $fromTime==-1)==false){
if(!empty($mode))
throw new Aliyun_Log_Exception ( 'RequestError',"Request is failed. Mode and fromTime can not be not empty simultaneously");
else
throw new Aliyun_Log_Exception ( 'RequestError',"Request is failed. Mode and fromTime can not be empty simultaneously");
}
if(!empty($mode) && strcmp($mode,'begin')!==0 && strcmp($mode,'end')!==0)
throw new Aliyun_Log_Exception ( 'RequestError',"Request is failed. Mode value invalid:$mode");
if($fromTime!==-1 && (is_integer($fromTime)==false || $fromTime<0))
throw new Aliyun_Log_Exception ( 'RequestError',"Request is failed. FromTime value invalid:$fromTime");
$params['type']='cursor';
if($fromTime!==-1)$params['from']=$fromTime;
else $params['mode'] = $mode;
$resource='/logstores/'.$logstore.'/shards/'.$shardId;
list($resp,$header) = $this->send("GET",$project,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_GetCursorResponse($resp,$header);
}
public function createConfig(Aliyun_Log_Models_CreateConfigRequest $request){
$params = array();
$headers = array();
$body=null;
if($request->getConfig()!==null){
$body = json_encode($request->getConfig()->toArray());
}
$headers ['Content-Type'] = 'application/json';
$resource = '/configs';
list($resp,$header) = $this->send("POST",NULL,$body,$resource,$params,$headers);
return new Aliyun_Log_Models_CreateConfigResponse($header);
}
public function updateConfig(Aliyun_Log_Models_UpdateConfigRequest $request){
$params = array();
$headers = array();
$body=null;
$configName='';
if($request->getConfig()!==null){
$body = json_encode($request->getConfig()->toArray());
$configName=($request->getConfig()->getConfigName()!==null)?$request->getConfig()->getConfigName():'';
}
$headers ['Content-Type'] = 'application/json';
$resource = '/configs/'.$configName;
list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers);
return new Aliyun_Log_Models_UpdateConfigResponse($header);
}
public function getConfig(Aliyun_Log_Models_GetConfigRequest $request){
$params = array();
$headers = array();
$configName = ($request->getConfigName()!==null)?$request->getConfigName():'';
$resource = '/configs/'.$configName;
list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_GetConfigResponse($resp,$header);
}
public function deleteConfig(Aliyun_Log_Models_DeleteConfigRequest $request){
$params = array();
$headers = array();
$configName = ($request->getConfigName()!==null)?$request->getConfigName():'';
$resource = '/configs/'.$configName;
list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers);
return new Aliyun_Log_Models_DeleteConfigResponse($header);
}
public function listConfigs(Aliyun_Log_Models_ListConfigsRequest $request){
$params = array();
$headers = array();
if($request->getConfigName()!==null)$params['configName'] = $request->getConfigName();
if($request->getOffset()!==null)$params['offset'] = $request->getOffset();
if($request->getSize()!==null)$params['size'] = $request->getSize();
$resource = '/configs';
list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_ListConfigsResponse($resp,$header);
}
public function createMachineGroup(Aliyun_Log_Models_CreateMachineGroupRequest $request){
$params = array();
$headers = array();
$body=null;
if($request->getMachineGroup()!==null){
$body = json_encode($request->getMachineGroup()->toArray());
}
$headers ['Content-Type'] = 'application/json';
$resource = '/machinegroups';
list($resp,$header) = $this->send("POST",NULL,$body,$resource,$params,$headers);
return new Aliyun_Log_Models_CreateMachineGroupResponse($header);
}
public function updateMachineGroup(Aliyun_Log_Models_UpdateMachineGroupRequest $request){
$params = array();
$headers = array();
$body=null;
$groupName='';
if($request->getMachineGroup()!==null){
$body = json_encode($request->getMachineGroup()->toArray());
$groupName=($request->getMachineGroup()->getGroupName()!==null)?$request->getMachineGroup()->getGroupName():'';
}
$headers ['Content-Type'] = 'application/json';
$resource = '/machinegroups/'.$groupName;
list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers);
return new Aliyun_Log_Models_UpdateMachineGroupResponse($header);
}
public function getMachineGroup(Aliyun_Log_Models_GetMachineGroupRequest $request){
$params = array();
$headers = array();
$groupName = ($request->getGroupName()!==null)?$request->getGroupName():'';
$resource = '/machinegroups/'.$groupName;
list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_GetMachineGroupResponse($resp,$header);
}
public function deleteMachineGroup(Aliyun_Log_Models_DeleteMachineGroupRequest $request){
$params = array();
$headers = array();
$groupName = ($request->getGroupName()!==null)?$request->getGroupName():'';
$resource = '/machinegroups/'.$groupName;
list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers);
return new Aliyun_Log_Models_DeleteMachineGroupResponse($header);
}
public function listMachineGroups(Aliyun_Log_Models_ListMachineGroupsRequest $request){
$params = array();
$headers = array();
if($request->getGroupName()!==null)$params['groupName'] = $request->getGroupName();
if($request->getOffset()!==null)$params['offset'] = $request->getOffset();
if($request->getSize()!==null)$params['size'] = $request->getSize();
$resource = '/machinegroups';
list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_ListMachineGroupsResponse($resp,$header);
}
public function applyConfigToMachineGroup(Aliyun_Log_Models_ApplyConfigToMachineGroupRequest $request){
$params = array();
$headers = array();
$configName=$request->getConfigName();
$groupName=$request->getGroupName();
$headers ['Content-Type'] = 'application/json';
$resource = '/machinegroups/'.$groupName.'/configs/'.$configName;
list($resp,$header) = $this->send("PUT",NULL,NULL,$resource,$params,$headers);
return new Aliyun_Log_Models_ApplyConfigToMachineGroupResponse($header);
}
public function removeConfigFromMachineGroup(Aliyun_Log_Models_RemoveConfigFromMachineGroupRequest $request){
$params = array();
$headers = array();
$configName=$request->getConfigName();
$groupName=$request->getGroupName();
$headers ['Content-Type'] = 'application/json';
$resource = '/machinegroups/'.$groupName.'/configs/'.$configName;
list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers);
return new Aliyun_Log_Models_RemoveConfigFromMachineGroupResponse($header);
}
public function getMachine(Aliyun_Log_Models_GetMachineRequest $request){
$params = array();
$headers = array();
$uuid = ($request->getUuid()!==null)?$request->getUuid():'';
$resource = '/machines/'.$uuid;
list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_GetMachineResponse($resp,$header);
}
public function createACL(Aliyun_Log_Models_CreateACLRequest $request){
$params = array();
$headers = array();
$body=null;
if($request->getAcl()!==null){
$body = json_encode($request->getAcl()->toArray());
}
$headers ['Content-Type'] = 'application/json';
$resource = '/acls';
list($resp,$header) = $this->send("POST",NULL,$body,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_CreateACLResponse($resp,$header);
}
public function updateACL(Aliyun_Log_Models_UpdateACLRequest $request){
$params = array();
$headers = array();
$body=null;
$aclId='';
if($request->getAcl()!==null){
$body = json_encode($request->getAcl()->toArray());
$aclId=($request->getAcl()->getAclId()!==null)?$request->getAcl()->getAclId():'';
}
$headers ['Content-Type'] = 'application/json';
$resource = '/acls/'.$aclId;
list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers);
return new Aliyun_Log_Models_UpdateACLResponse($header);
}
public function getACL(Aliyun_Log_Models_GetACLRequest $request){
$params = array();
$headers = array();
$aclId = ($request->getAclId()!==null)?$request->getAclId():'';
$resource = '/acls/'.$aclId;
list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_GetACLResponse($resp,$header);
}
public function deleteACL(Aliyun_Log_Models_DeleteACLRequest $request){
$params = array();
$headers = array();
$aclId = ($request->getAclId()!==null)?$request->getAclId():'';
$resource = '/acls/'.$aclId;
list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers);
return new Aliyun_Log_Models_DeleteACLResponse($header);
}
public function listACLs(Aliyun_Log_Models_ListACLsRequest $request){
$params = array();
$headers = array();
if($request->getPrincipleId()!==null)$params['principleId'] = $request->getPrincipleId();
if($request->getOffset()!==null)$params['offset'] = $request->getOffset();
if($request->getSize()!==null)$params['size'] = $request->getSize();
$resource = '/acls';
list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers);
$requestId = isset ( $header ['x-log-requestid'] ) ? $header ['x-log-requestid'] : '';
$resp = $this->parseToJson ( $resp, $requestId );
return new Aliyun_Log_Models_ListACLsResponse($resp,$header);
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
/**
* The Exception of the log serivce request & response.
*
* @author log service dev
*/
class Aliyun_Log_Exception extends Exception{
/**
* @var string
*/
private $requestId;
/**
* Aliyun_Log_Exception constructor
*
* @param string $code
* log service error code.
* @param string $message
* detailed information for the exception.
* @param string $requestId
* the request id of the response, '' is set if client error.
*/
public function __construct($code, $message, $requestId='') {
parent::__construct($message);
$this->code = $code;
$this->message = $message;
$this->requestId = $requestId;
}
/**
* The __toString() method allows a class to decide how it will react when
* it is treated like a string.
*
* @return string
*/
public function __toString() {
return "Aliyun_Log_Exception: \n{\n ErrorCode: $this->code,\n ErrorMessage: $this->message\n RequestId: $this->requestId\n}\n";
}
/**
* Get Aliyun_Log_Exception error code.
*
* @return string
*/
public function getErrorCode() {
return $this->code;
}
/**
* Get Aliyun_Log_Exception error message.
*
* @return string
*/
public function getErrorMessage() {
return $this->message;
}
/**
* Get log service sever requestid, '' is set if client or Http error.
*
* @return string
*/
public function getRequestId() {
return $this->requestId;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
/**
* Class Aliyun_Log_LoggerFactory
* Factory for creating logger instance, with $client, $project, $logstore, $topic configurable.
* Will flush current logger when the factory instance was recycled.
*/
class Aliyun_Log_LoggerFactory{
private static $loggerMap = array();
/**
* Get logger instance
* @param $client valid log client
* @param $project which could be created in AliYun Logger Server configuration page
* @param $logstore which could be created in AliYun Logger Server configuration page
* @param null $topic used to specified the log by TOPIC field
* @return mixed return logger instance
* @throws Exception if the input parameter is invalid, throw exception
*/
public static function getLogger($client, $project, $logstore, $topic = null){
if($project === null || $project == ''){
throw new Exception('project name is blank!');
}
if($logstore === null || $logstore == ''){
throw new Exception('logstore name is blank!');
}
if($topic === null){
$topic = '';
}
$loggerKey = $project.'#'.$logstore.'#'.$topic;
if (!array_key_exists($loggerKey, static::$loggerMap))
{
$instanceSimpleLogger = new Aliyun_Log_SimpleLogger($client,$project,$logstore,$topic);
static::$loggerMap[$loggerKey] = $instanceSimpleLogger;
}
return static::$loggerMap[$loggerKey];
}
/**
* set modifier to protected for singleton pattern
* Aliyun_Log_LoggerFactory constructor.
*/
protected function __construct()
{
}
/**
* set clone function to private for singleton pattern
*/
private function __clone()
{}
/**
* flush current logger in destruct function
*/
function __destruct() {
if(static::$loggerMap != null){
foreach (static::$loggerMap as $innerLogger){
$innerLogger->logFlush();
}
}
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
class Aliyun_Log_Models_ACL {
private $principleType;
private $principleId;
private $object;
private $privilege;
private $aclId;
private $createTime;
private $lastModifyTime;
public function __construct($principleType='',$principleId='',$object='',
$privilege=array(),$aclId=null,$createTime=null,$lastModifyTime=null) {
$this->principleType = $principleType;
$this->principleId = $principleId;
$this->object = $object;
$this->privilege = $privilege;
$this->aclId = $aclId;
$this->createTime = $createTime;
$this->lastModifyTime = $lastModifyTime;
}
public function getPrincipleType(){
return $this->principleType;
}
public function setPrincipleType($principleType){
$this->principleType = $principleType;
}
public function getPrincipleId(){
return $this->principleId;
}
public function setPrincipleId($principleId){
$this->principleId = $principleId;
}
public function getObject(){
return $this->object;
}
public function setObject($object){
$this->object = $object;
}
public function getPrivilege(){
return $this->privilege;
}
public function setPrivilege($privilege){
$this->privilege = $privilege;
}
public function getAclId(){
return $this->aclId;
}
public function setAclId($aclId){
$this->aclId = $aclId;
}
public function getCreateTime(){
return $this->createTime;
}
public function setCreateTime($createTime){
$this->createTime = $createTime;
}
public function getLastModifyTime(){
return $this->lastModifyTime;
}
public function setLastModifyTime($lastModifyTime){
$this->lastModifyTime = $lastModifyTime;
}
public function toArray(){
$format_array = array();
if($this->principleType!==null)
$format_array['principleType'] = $this->principleType;
if($this->principleId!==null)
$format_array['principleId'] = $this->principleId;
if($this->object!==null)
$format_array['object'] = $this->object;
if($this->privilege!==null)
$format_array['privilege'] = $this->privilege;
if($this->aclId!==null)
$format_array['aclId'] = $this->aclId;
if($this->createTime!==null)
$format_array['createTime'] = $this->createTime;
if($this->lastModifyTime!==null)
$format_array['lastModifyTime'] = $this->lastModifyTime;
return $format_array;
}
public function setFromArray($resp){
$principleType = ($resp['principleType']!==null)?$resp['principleType']:null;
$principleId = ($resp['principleId']!==null)?$resp['principleId']:null;
$object = ($resp['object']!==null)?$resp['object']:null;
$privilege = ($resp['privilege']!==null)?$resp['privilege']:array();
$aclId = ($resp['aclId']!==null)?$resp['aclId']:null;
$createTime = ($resp['createTime']!==null)?$resp['createTime']:null;
$lastModifyTime = ($resp['lastModifyTime']!==null)?$resp['lastModifyTime']:null;
$this->setPrincipleType($principleType);
$this->setPrincipleId($principleId);
$this->setObject($object);
$this->setPrivilege($privilege);
$this->setAclId($aclId);
$this->setCreateTime($createTime);
$this->setLastModifyTime($lastModifyTime);
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
/**
* Aliyun_Log_Models_CompressedLogGroup is compressed LogGroup,
* LogGroup infomation please refer to Aliyun_Log_Models_LogGroup
*
* @author log service dev
*/
class Aliyun_Log_Models_CompressedLogGroup {
/**
* @var integer uncompressed LogGroup size
*
*/
protected $uncompressedSize;
/**
* @var integer uncompressed LogGroup size
*
*/
protected $compressedData;
public function __construct($time = null, $contents = null) {
if (! $time)
$time = time ();
$this->time = $time;
if ($contents)
$this->contents = $contents;
else
$this->contents = array ();
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
class Aliyun_Log_Models_Config_InputDetail {
public $filePattern;
public $key;
public $localStorage;
public $logBeginRegex;
public $logPath;
public $logType;
public $regex;
public $timeFormat;
public $filterRegex;
public $filterKey;
public $topicFormat;
public function __construct($filePattern='',$key=array(),$localStorage=true,
$logBeginRegex='',$logPath='',$logType='',$regex='',
$timeFormat='',$filterRegex=array(),$filterKey=array(),$topicFormat='none'){
$this->filePattern=$filePattern;
$this->key=$key;
$this->localStorage=$localStorage;
$this->logBeginRegex=$logBeginRegex;
$this->logPath=$logPath;
$this->logType=$logType;
$this->regex=$regex;
$this->timeFormat=$timeFormat;
$this->filterRegex=$filterRegex;
$this->filterKey=$filterKey;
$this->topicFormat=$topicFormat;
}
public function toArray(){
$resArray = array();
if($this->filePattern!==null)
$resArray['filePattern'] = $this->filePattern;
if($this->key!==null)
$resArray['key'] = $this->key;
if($this->localStorage!==null)
$resArray['localStorage'] = $this->localStorage;
if($this->logBeginRegex!==null)
$resArray['logBeginRegex'] = $this->logBeginRegex;
if($this->logPath!==null)
$resArray['logPath'] = $this->logPath;
if($this->logType!==null)
$resArray['logType'] = $this->logType;
if($this->regex!==null)
$resArray['regex'] = $this->regex;
if($this->timeFormat!==null)
$resArray['timeFormat'] = $this->timeFormat;
if($this->filterRegex!==null)
$resArray['filterRegex'] = $this->filterRegex;
if($this->filterKey!==null)
$resArray['filterKey'] = $this->filterKey;
if($this->topicFormat!==null)
$resArray['topicFormat'] = $this->topicFormat;
return $resArray;
}
}
class Aliyun_Log_Models_Config_OutputDetail {
public $projectName;
public $logstoreName;
public function __construct($projectName='',$logstoreName=''){
$this->projectName = $projectName;
$this->logstoreName = $logstoreName;
}
public function toArray(){
$resArray = array();
if($this->projectName!==null)
$resArray['projectName'] = $this->projectName;
if($this->logstoreName!==null)
$resArray['logstoreName'] = $this->logstoreName;
return $resArray;
}
}
class Aliyun_Log_Models_Config {
private $configName;
private $inputType;
private $inputDetail;
private $outputType;
private $outputDetail;
private $createTime;
private $lastModifyTime;
public function __construct($configName='',$inputType='',$inputDetail=null,
$outputType='',$outputDetail=null,$createTime=null,$lastModifyTime=null) {
$this->configName = $configName;
$this->inputType = $inputType;
$this->inputDetail = $inputDetail;
$this->outputType = $outputType;
$this->outputDetail = $outputDetail;
$this->createTime = $createTime;
$this->lastModifyTime = $lastModifyTime;
}
public function getConfigName(){
return $this->configName;
}
public function setConfigName($configName){
$this->configName = $configName;
}
public function getInputType(){
return $this->inputType;
}
public function setInputType($inputType){
$this->inputType = $inputType;
}
public function getInputDetail(){
return $this->inputDetail;
}
public function setInputDetail($inputDetail){
$this->inputDetail = $inputDetail;
}
public function getOutputType(){
return $this->outputType;
}
public function setOutputType($outputType){
$this->outputType = $outputType;
}
public function getOutputDetail(){
return $this->outputDetail;
}
public function setOutputDetail($outputDetail){
$this->outputDetail = $outputDetail;
}
public function getCreateTime(){
return $this->createTime;
}
public function setCreateTime($createTime){
$this->createTime = $createTime;
}
public function getLastModifyTime(){
return $this->lastModifyTime;
}
public function setLastModifyTime($lastModifyTime){
$this->lastModifyTime = $lastModifyTime;
}
public function toArray(){
$format_array = array();
if($this->configName!==null)
$format_array['configName'] = $this->configName;
if($this->inputType!==null)
$format_array['inputType'] = $this->inputType;
if($this->inputDetail!==null)
$format_array['inputDetail'] = $this->inputDetail->toArray();
if($this->outputType!==null)
$format_array['outputType'] = $this->outputType;
if($this->outputDetail!==null)
$format_array['outputDetail'] = $this->outputDetail->toArray();
if($this->createTime!==null)
$format_array['createTime'] = $this->createTime;
if($this->lastModifyTime!==null)
$format_array['lastModifyTime'] = $this->lastModifyTime;
return $format_array;
}
public function setFromArray($resp){
$inputDetail = new Aliyun_Log_Models_Config_InputDetail();
$inputDetail->filePattern = $resp['inputDetail']['filePattern'];
$inputDetail->key = $resp['inputDetail']['key'];
$inputDetail->localStorage = $resp['inputDetail']['localStorage'];
$inputDetail->logBeginRegex = $resp['inputDetail']['logBeginRegex'];
$inputDetail->logPath = $resp['inputDetail']['logPath'];
$inputDetail->logType = $resp['inputDetail']['logType'];
$inputDetail->regex = $resp['inputDetail']['regex'];
$inputDetail->timeFormat = $resp['inputDetail']['timeFormat'];
$inputDetail->filterRegex = $resp['inputDetail']['filterRegex'];
$inputDetail->filterKey = $resp['inputDetail']['filterKey'];
$inputDetail->topicFormat = $resp['inputDetail']['topicFormat'];
$outputDetail = new Aliyun_Log_Models_Config_OutputDetail();
$outputDetail->projectName = $resp['outputDetail']['projectName'];
$outputDetail->logstoreName = $resp['outputDetail']['logstoreName'];
$configName=$resp['configName'];
$inputType=$resp['inputType'];
$outputType=$resp['outputType'];
$this->setConfigName($configName);
$this->setInputType($inputType);
$this->setInputDetail($inputDetail);
$this->setOutputType($outputType);
$this->setOutputDetail($outputDetail);
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
/**
* The class used to present the result of log histogram status. For every log
* histogram, it contains : from/to time range, hit log count and query
* completed status.
*
* @author log service dev
*/
class Aliyun_Log_Models_Histogram {
/**
* @var integer the begin time
*/
private $from;
/**
* @var integer the end time
*/
private $to;
/**
* @var integer log count of histogram that query hits
*/
private $count;
/**
* @var string histogram query status(Complete or InComplete)
*/
private $progress;
/**
* Aliyun_Log_Models_Histogram constructor
*
* @param integer $from
* the begin time
* @param integer $to
* the end time
* @param integer $count
* log count of histogram that query hits
* @param string $progress
* histogram query status(Complete or InComplete)
*/
public function __construct($from, $to, $count, $progress) {
$this->from = $from;
$this->to = $to;
$this->count = $count;
$this->progress = $progress;
}
/**
* Get begin time
*
* @return integer the begin time
*/
public function getFrom() {
return $this->from;
}
/**
* Get the end time
*
* @return integer the end time
*/
public function getTo() {
return $this->to;
}
/**
* Get log count of histogram that query hits
*
* @return integer log count of histogram that query hits
*/
public function getCount() {
return $this->count;
}
/**
* Check if the histogram is completed
*
* @return bool true if this histogram is completed
*/
public function isCompleted() {
return $this->progress == 'Complete';
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
/**
* Aliyun_Log_Models_LogItem used to present a log, it contains log time and multiple
* key/value pairs to present the log contents.
*
* @author log service dev
*/
class Aliyun_Log_Models_LogItem {
/**
* @var integer time of the log item, the default time if the now time.
*/
private $time;
/**
* @var array the data of the log item, including many key/value pairs.
*/
private $contents;
/**
* Aliyun_Log_Models_LogItem cnostructor
*
* @param array $contents
* the data of the log item, including many key/value pairs.
* @param integer $time
* time of the log item, the default time if the now time.
*/
public function __construct($time = null, $contents = null) {
if (! $time)
$time = time ();
$this->time = $time;
if ($contents)
$this->contents = $contents;
else
$this->contents = array ();
}
/**
* Get log time
*
* @return integer log time
*/
public function getTime() {
return $this->time;
}
/**
* Set log time
*
* @param integer $time
* log time
*/
public function setTime($time) {
$this->time = $time;
}
/**
* Get log contents
*
* @return array log contents
*/
public function getContents() {
return $this->contents;
}
/**
* Set log contents
*
* @param array $contents
* log contents
*/
public function setContents($contents) {
$this->contents = $contents;
}
/**
* Add a key/value pair as log content to the log
*
* @param string $key
* log content key
* @param string $value
* log content value
*/
public function pushBack($key, $value) {
$this->contents [$key] = $value;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
class Aliyun_Log_Models_LogLevel_LogLevel{
const debug = 'debug';
const info = 'info';
const warn = 'warn';
const error = 'error';
private static $constCacheArray = NULL;
private $level;
/**
* Constructor
*
* @param string $level
*/
private function __construct($level) {
$this->level = $level;
}
/**
* Compares two logger levels.
*
* @param LoggerLevels $other
* @return boolean
*/
public function equals($other) {
if($other instanceof Aliyun_Log_Models_LogLevel_LogLevel) {
if($this->level == $other->level) {
return true;
}
} else {
return false;
}
}
public static function getLevelDebug(){
if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::debug])){
self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::debug] = new Aliyun_Log_Models_LogLevel_LogLevel('debug');
}
return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::debug];
}
public static function getLevelInfo(){
if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::info])){
self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::info] = new Aliyun_Log_Models_LogLevel_LogLevel('info');
}
return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::info];
}
public static function getLevelWarn(){
if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::warn])){
self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::warn] = new Aliyun_Log_Models_LogLevel_LogLevel('warn');
}
return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::warn];
}
public static function getLevelError(){
if(!isset(self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::error])){
self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::error] = new Aliyun_Log_Models_LogLevel_LogLevel('error');
}
return self::$constCacheArray[Aliyun_Log_Models_LogLevel_LogLevel::error];
}
public static function getLevelStr(Aliyun_Log_Models_LogLevel_LogLevel $logLevel){
$logLevelStr = '';
if(null === $logLevel){
$logLevelStr = 'info';
}
switch ($logLevel->level){
case "error":
$logLevelStr= 'error';
break;
case "warn":
$logLevelStr= 'warn';
break;
case "info":
$logLevelStr= 'info';
break;
case "debug":
$logLevelStr= 'debug';
break;
}
return $logLevelStr;
}
}
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
class Aliyun_Log_Models_Machine_Info{
public $ip;
public $os;
public $hostName;
public function __construct($ip=null,$os=null,$hostName=null){
$this->ip = $ip;
$this->os = $os;
$this->hostName = $hostName;
}
public function getIp(){
return $this->ip;
}
public function setIp($ip){
$this->ip = $ip;
}
public function getOs(){
return $this->os;
}
public function setOs($os){
$this->os = $os;
}
public function getHostName(){
return $this->hostName;
}
public function setHostName($hostname){
$this->hostName = $hostName;
}
public function toArray(){
$resArr = array();
if($this->ip!==null)
$resArr['ip'] = $this->ip;
if($this->os!==null)
$resArr['os'] = $this->os;
if($this->hostName!==null)
$resArr['hostName'] = $this->hostName;
return $resArr;
}
}
class Aliyun_Log_Models_Machine_Status{
public $binaryCurVersion;
public $binaryDeployVersion;
public function __construct($binaryCurVersion=null,$binaryDeployVersion=null){
$this->binaryCurVersion = $binaryCurVersion;
$this->binaryDeployVersion = $binaryDeployVersion;
}
public function toArray(){
$resArr = array();
if($this->binaryCurVersion!==null)
$resArr['binaryCurVersion'] = $this->binaryCurVersion;
if($this->binaryDeployVersion!==null)
$resArr['binaryDeployVersion'] = $this->binaryDeployVersion;
return $resArr;
}
}
class Aliyun_Log_Models_Machine {
private $uuid;
private $lastHeartbeatTime;
private $info;
private $status;
private $createTime;
private $lastModifyTime;
public function __construct($uuid=null,$lastHeartbeatTime=null,$info=null,
$status=null,$createTime=null,$lastModifyTime=null) {
$this->uuid = $uuid;
$this->lastHeartbeatTime = $lastHeartbeatTime;
$this->info = $info;
$this->status = $status;
$this->createTime = $createTime;
$this->lastModifyTime = $lastModifyTime;
}
public function getUuid(){
return $this->uuid;
}
public function setUuid($uuid){
$this->uuid = $uuid;
}
public function getLastHeartbeatTime(){
return $this->lastHeartbeatTime;
}
public function setLastHeartbeatTime($lastHeartbeatTime){
$this->lastHeartbeatTime = $lastHeartbeatTime;
}
public function getInfo(){
return $this->info;
}
public function setInfo($info){
$this->info = $info;
}
public function getStatus(){
return $this->status;
}
public function setStatus($status){
$this->status = $status;
}
public function getCreateTime(){
return $this->createTime;
}
public function setCreateTime($createTime){
$this->createTime = $createTime;
}
public function getLastModifyTime(){
return $this->lastModifyTime;
}
public function setLastModifyTime($lastModifyTime){
$this->lastModifyTime = $lastModifyTime;
}
public function toArray(){
$resArr = array();
if($this->uuid!==null)
$resArr['uuid'] = $this->uuid;
if($this->lastHeartbeatTime!==null)
$resArr['lastHeartbeatTime'] = $this->lastHeartbeatTime;
if($this->info!==null)
$resArr['info'] = $this->info->toArray();
if($this->status!==null)
$resArr['status'] = $this->status->toArray();
if($this->createTime!==null)
$resArr['createTime'] = $this->createTime;
if($this->lastModifyTime!==null)
$resArr['lastModifyTime'] = $this->lastModifyTime;
return $resArr;
}
public function setFromArray($resp){
$info=null;
if(isset($resp['info'])){
$ip=(isset($resp['info']['ip']))?$resp['info']['ip']:null;
$os=(isset($resp['info']['os']))?$resp['info']['os']:null;
$hostName=(isset($resp['info']['hostName']))?$resp['info']['hostName']:null;
$info = new Aliyun_Log_Models_Machine_Info($ip,$os,$hostName);
}
$status = null;
if(isset($resp['status'])){
$binaryCurVersion=(isset($resp['status']['binaryCurVersion']))?$resp['status']['binaryCurVersion']:null;
$binaryDeployVersion=(isset($resp['status']['binaryDeployVersion']))?$resp['status']['binaryDeployVersion']:null;
$status = new Aliyun_Log_Models_Machine_Status($binaryCurVersion,$binaryDeployVersion);
}
$uuid=(isset($resp['uuid']))?$resp['uuid']:null;
$lastHeartbeatTime=(isset($resp['lastHeartbeatTime']))?$resp['lastHeartbeatTime']:null;
$createTime=(isset($resp['createTime']))?$resp['createTime']:null;
$lastModifyTime=(isset($resp['lastModifyTime']))?$resp['lastModifyTime']:null;
$this->setUuid($uuid);
$this->setLastHeartbeatTime($lastHeartbeatTime);
$this->setInfo($info);
$this->setStatus($status);
$this->setCreateTime($createTime);
$this->setLastModifyTime($lastModifyTime);
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
class Aliyun_Log_Models_MachineGroup_GroupAttribute {
public $externalName;
public $groupTopic;
public function __construct($externalName=null,$groupTopic=null){
$this->externalName = $externalName;
$this->groupTopic = $groupTopic;
}
public function toArray(){
$resArray = array();
if($this->externalName!==null)
$resArray['externalName'] = $this->externalName;
if($this->groupTopic!==null)
$resArray['groupTopic'] = $this->groupTopic;
return $resArray;
}
}
class Aliyun_Log_Models_MachineGroup {
private $groupName;
private $groupType;
private $groupAttribute;
private $machineList;
private $createTime;
private $lastModifyTime;
public function __construct($groupName='',$groupType='',$groupAttribute=null,
$machineList=null,$createTime=null,$lastModifyTime=null) {
$this->groupName = $groupName;
$this->groupType = $groupType;
$this->groupAttribute = $groupAttribute;
$this->machineList = $machineList;
$this->createTime = $createTime;
$this->lastModifyTime = $lastModifyTime;
}
public function getGroupName(){
return $this->groupName;
}
public function setGroupName($groupName){
$this->groupName = $groupName;
}
public function getGroupType(){
return $this->groupType;
}
public function setGroupType($groupType){
$this->groupType = $groupType;
}
public function getGroupAttribute(){
return $this->groupAttribute;
}
public function setGroupAttribute($groupAttribute){
$this->groupAttribute = $groupAttribute;
}
public function getMachineList(){
return $this->machineList;
}
public function setMachineList($machineList){
$this->machineList = $machineList;
}
public function getCreateTime(){
return $this->createTime;
}
public function setCreateTime($createTime){
$this->createTime = $createTime;
}
public function getLastModifyTime(){
return $this->lastModifyTime;
}
public function setLastModifyTime($lastModifyTime){
$this->lastModifyTime = $lastModifyTime;
}
public function toArray(){
$format_array = array();
if($this->groupName!==null)
$format_array['groupName'] = $this->groupName;
if($this->groupType!==null)
$format_array['groupType'] = $this->groupType;
if($this->groupAttribute!==null)
$format_array['groupAttribute'] = $this->groupAttribute->toArray();
if($this->machineList!==null){
$mlArr = array();
foreach($this->machineList as $value){
$mlArr[] = $value->toArray();
}
$format_array['machineList'] = $mlArr;
}
if($this->createTime!==null)
$format_array['createTime'] = $this->createTime;
if($this->lastModifyTime!==null)
$format_array['lastModifyTime'] = $this->lastModifyTime;
return $format_array;
}
public function setFromArray($resp){
$groupAttribute = null;
if(isset($resp['groupAttribute'])){
$groupAttributeArr = $resp['groupAttribute'];
$groupAttribute = new Aliyun_Log_Models_MachineGroup_GroupAttribute();
if(isset($groupAttributeArr['externalName']))
$groupAttribute->externalName = $groupAttributeArr['externalName'];
if(isset($groupAttributeArr['groupTopic']))
$groupAttribute->groupTopic = $groupAttributeArr['groupTopic'];
}
$groupName = ($resp['groupName']!==null)?$resp['groupName']:null;
$groupType = ($resp['groupType']!==null)?$resp['groupType']:null;
$machineList = array();
if(isset($resp['machineList']) && is_array($resp['machineList']) && count($resp['machineList'])>0){
foreach($resp['machineList'] as $value){
$machine = new Aliyun_Log_Models_Machine();
$machine->setFromArray($value);
$machineList[] = $machine;
}
}
$createTime = ($resp['createTime']!==null)?$resp['createTime']:null;
$lastModifyTime = ($resp['lastModifyTime']!==null)?$resp['lastModifyTime']:null;
$this->setGroupName($groupName);
$this->setGroupType($groupType);
$this->setGroupAttribute($groupAttribute);
$this->setMachineList($machineList);
$this->setCreateTime($createTime);
$this->setLastModifyTime($lastModifyTime);
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
class Aliyun_Log_Models_OssShipperConfig{
private $ossBucket;
private $ossPrefix;
private $bufferInterval = 300;
private $bufferSize;
private $compressType;
private $roleArn;
private $pathFormat;
private $storage;
/**
* @return mixed
*/
public function getRoleArn()
{
return $this->roleArn;
}
/**
* @param mixed $roleArn
*/
public function setRoleArn($roleArn)
{
$this->roleArn = $roleArn;
}
/**
* @return mixed
*/
public function getPathFormat()
{
return $this->pathFormat;
}
/**
* @param mixed $pathFormat
*/
public function setPathFormat($pathFormat)
{
$this->pathFormat = $pathFormat;
}
/**
* @return mixed
*/
public function getStorage()
{
return $this->storage;
}
/**
* @param mixed $storage
*/
public function setStorage($storage)
{
$this->storage = $storage;
}
/**
* @return mixed
*/
public function getOssBucket()
{
return $this->ossBucket;
}
/**
* @param mixed $ossBucket
*/
public function setOssBucket($ossBucket)
{
$this->ossBucket = $ossBucket;
}
/**
* @return mixed
*/
public function getOssPrefix()
{
return $this->ossPrefix;
}
/**
* @param mixed $ossPrefix
*/
public function setOssPrefix($ossPrefix)
{
$this->ossPrefix = $ossPrefix;
}
/**
* @return mixed
*/
public function getBufferInterval()
{
return $this->bufferInterval;
}
/**
* @param mixed $bufferInterval
*/
public function setBufferInterval($bufferInterval)
{
$this->bufferInterval = $bufferInterval;
}
/**
* @return mixed
*/
public function getBufferSize()
{
return $this->bufferSize;
}
/**
* @param mixed $bufferSize
*/
public function setBufferSize($bufferSize)
{
if($bufferSize > 256 || $bufferSize < 5){
throw new Exception("buffSize is not valide, must between 5 and 256");
}
$this->bufferSize = $bufferSize;
}
/**
* @return mixed
*/
public function getCompressType()
{
return $this->compressType;
}
/**
* @param mixed $compressType
*/
public function setCompressType($compressType)
{
$this->compressType = $compressType;
}
public function to_json_object() {
$json = array(
'ossBucket' => $this->ossBucket,
'ossPrefix' => $this->ossPrefix,
'bufferInterval' => $this->bufferInterval,
'bufferSize' => $this->bufferSize,
'compressType' => $this->compressType,
'roleArn' => $this->roleArn,
'pathFormat' => $this->pathFormat,
'storage' => $this->storage->to_json_object()
);
if($this->storage->getFormat() == 'json'){
unset($json['storage']);
}
return $json;
}
}
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
class Aliyun_Log_Models_OssShipperCsvStorage extends Aliyun_Log_Models_OssShipperStorage{
private $columns;
private $delimiter = ',';
private $quote = '';
private $nullIdentifier = '';
private $header = false;
/**
* @return mixed
*/
public function getColumns()
{
return $this->columns;
}
/**
* @param mixed $columns
*/
public function setColumns($columns)
{
$this->columns = $columns;
}
/**
* @return string
*/
public function getDelimiter(): string
{
return $this->delimiter;
}
/**
* @param string $delimiter
*/
public function setDelimiter(string $delimiter)
{
$this->delimiter = $delimiter;
}
/**
* @return string
*/
public function getQuote(): string
{
return $this->quote;
}
/**
* @param string $quote
*/
public function setQuote(string $quote)
{
$this->quote = $quote;
}
/**
* @return string
*/
public function getNullIdentifier(): string
{
return $this->nullIdentifier;
}
/**
* @param string $nullIdentifier
*/
public function setNullIdentifier(string $nullIdentifier)
{
$this->nullIdentifier = $nullIdentifier;
}
/**
* @return bool
*/
public function isHeader(): bool
{
return $this->header;
}
/**
* @param bool $header
*/
public function setHeader(bool $header)
{
$this->header = $header;
}
public function to_json_object(){
$detail = array(
'columns' => $this->columns,
'delimiter' => $this->delimiter,
'quote' => $this->quote,
'nullIdentifier' => $this->nullIdentifier,
'header' => $this->header
);
return array(
'detail' => $detail,
'format' => parent::getFormat()
);
}
}
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
class Aliyun_Log_Models_OssShipperJsonStorage extends Aliyun_Log_Models_OssShipperStorage{
public function to_json_object(){
return array();
}
}
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
class Aliyun_Log_Models_OssShipperParquetStorage extends Aliyun_Log_Models_OssShipperStorage{
private $columns;
/**
* @return mixed
*/
public function getColumns()
{
return $this->columns;
}
/**
* @param mixed $columns
*/
public function setColumns($columns)
{
$this->columns = $columns;
}
public function to_json_object(){
$detail = array(
'columns' => $this->columns
);
return array(
'detail' => $detail,
'format' => parent::getFormat()
);
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
class Aliyun_Log_Models_OssShipperStorage{
private $format;
/**
* @return mixed
*/
public function getFormat()
{
return $this->format;
}
/**
* @param mixed $format
*/
public function setFormat($format)
{
$this->format = $format;
}
}
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_ApplyConfigToMachineGroupRequest extends Aliyun_Log_Models_Request {
private $groupName;
private $configName;
/**
* Aliyun_Log_Models_ApplyConfigToMachineGroupRequest Constructor
*
*/
public function __construct($groupName=null,$configName=null) {
$this->groupName = $groupName;
$this->configName = $configName;
}
public function getGroupName(){
return $this->groupName;
}
public function setGroupName($groupName){
$this->groupName = $groupName;
}
public function getConfigName(){
return $this->configName;
}
public function setConfigName($configName){
$this->configName = $configName;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
* The request used to get logs by logstore and shardId from log service.
*
* @author log service dev
*/
class Aliyun_Log_Models_BatchGetLogsRequest extends Aliyun_Log_Models_Request {
/**
* @var string logstore name
*/
private $logstore;
/**
* @var string shard ID
*/
private $shardId;
/**
* @var integer max line number of return logs
*/
private $count;
/**
* @var string start cursor
*/
private $cursor;
/**
* @var string end cursor
*/
private $endCursor;
/**
* Aliyun_Log_Models_BatchGetLogsRequest Constructor
*
* @param string $project
* project name
* @param string $logStore
* logstore name
* @param string $shardId
* shard ID
* @param integer $count
* return max loggroup numbers
* @param string $cursor
* start cursor
* @param string $end_cursor
* end cursor
*/
public function __construct($project = null, $logstore = null, $shardId = null, $count = null, $cursor = null, $end_cursor = null) {
parent::__construct ( $project );
$this->logstore = $logstore;
$this->shardId = $shardId;
$this->count = $count;
$this->cursor = $cursor;
$this->endCursor = $end_cursor;
}
/**
* Get logstore name
*
* @return string logstore name
*/
public function getLogstore() {
return $this->logstore;
}
/**
* Set logstore name
*
* @param string $logstore
* logstore name
*/
public function setLogstore($logstore) {
$this->logstore = $logstore;
}
/**
* Get shard ID
*
* @return string shardId
*/
public function getShardId() {
return $this->shardId;
}
/**
* Set shard ID
*
* @param string $shardId
* shard ID
*/
public function setShardId($shardId) {
$this->shardId = $shardId;
}
/**
* Get max return loggroup number
*
* @return integer count
*/
public function getCount() {
return $this->count;
}
/**
* Set max return loggroup number
*
* @param integer $count
* max return loggroup number
*/
public function setCount($count) {
$this->count = $count;
}
/**
* Get start cursor
*
* @return string cursor
*/
public function getCursor() {
return $this->cursor;
}
/**
* Get end cursor
*
* @return string cursor
*/
public function getEndCursor() {
return $this->endCursor;
}
/**
* Set start cursor
*
* @param string $cursor
* start cursor
*/
public function setCursor($cursor) {
$this->cursor = $cursor;
}
/**
* Set end cursor
*
* @param string $cursor
* end cursor
*/
public function setEndCursor($cursor) {
$this->endCursor = $cursor;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_CreateACLRequest extends Aliyun_Log_Models_Request {
private $acl;
/**
* Aliyun_Log_Models_CreateACLRequest Constructor
*
*/
public function __construct($acl=null) {
$this->acl = $acl;
}
public function getAcl(){
return $this->acl;
}
public function setAcl($acl){
$this->acl = $acl;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_CreateConfigRequest extends Aliyun_Log_Models_Request {
private $config;
/**
* Aliyun_Log_Models_CreateConfigRequest Constructor
*
*/
public function __construct($config) {
$this->config = $config;
}
public function getConfig(){
return $this->config;
}
public function setConfig($config){
$this->config = $config;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
* The request used to create logstore from log service.
*
* @author log service dev
*/
class Aliyun_Log_Models_CreateLogstoreRequest extends Aliyun_Log_Models_Request{
private $logstore;
private $ttl;
private $shardCount;
/**
* Aliyun_Log_Models_CreateLogstoreRequest constructor
*
* @param string $project project name
*/
public function __construct($project=null,$logstore = null,$ttl = null,$shardCount = null) {
parent::__construct($project);
$this -> logstore = $logstore;
$this -> ttl = $ttl;
$this -> shardCount = $shardCount;
}
public function getLogstore()
{
return $this -> logstore;
}
public function getTtl()
{
return $this -> ttl;
}
public function getShardCount()
{
return $this -> shardCount;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_CreateMachineGroupRequest extends Aliyun_Log_Models_Request {
private $machineGroup;
/**
* Aliyun_Log_Models_CreateMachineGroupRequest Constructor
*
*/
public function __construct($machineGroup=null) {
$this->machineGroup = $machineGroup;
}
public function getMachineGroup(){
return $this->machineGroup;
}
public function setMachineGroup($machineGroup){
$this->machineGroup = $machineGroup;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_CreateShipperRequest extends Aliyun_Log_Models_Request {
private $shipperName;
private $targetType;
private $targetConfigration;
private $logStore;
/**
* @return mixed
*/
public function getLogStore()
{
return $this->logStore;
}
/**
* @param mixed $logStore
*/
public function setLogStore($logStore)
{
$this->logStore = $logStore;
}
/**
* Aliyun_Log_Models_CreateShipperRequest Constructor
*
*/
public function __construct($project) {
parent::__construct ( $project );
}
/**
* @return mixed
*/
public function getShipperName()
{
return $this->shipperName;
}
/**
* @param mixed $shipperName
*/
public function setShipperName($shipperName)
{
$this->shipperName = $shipperName;
}
/**
* @return mixed
*/
public function getTargetType()
{
return $this->targetType;
}
/**
* @param mixed $targetType
*/
public function setTargetType($targetType)
{
$this->targetType = $targetType;
}
/**
* @return mixed
*/
public function getTargetConfigration()
{
return $this->targetConfigration;
}
/**
* @param mixed $targetConfigration
*/
public function setTargetConfigration($targetConfigration)
{
$this->targetConfigration = $targetConfigration;
}
}
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_DeleteACLRequest extends Aliyun_Log_Models_Request {
private $aclId;
/**
* Aliyun_Log_Models_DeleteACLRequest Constructor
*
*/
public function __construct($aclId=null) {
$this->aclId = $aclId;
}
public function getAclId(){
return $this->aclId;
}
public function setAclId($aclId){
$this->aclId = $aclId;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_DeleteConfigRequest extends Aliyun_Log_Models_Request {
private $configName;
/**
* Aliyun_Log_Models_DeleteConfigRequest Constructor
*
*/
public function __construct($configName=null) {
$this->configName = $configName;
}
public function getConfigName(){
return $this->configName;
}
public function setConfigName($configName){
$this->configName=$configName;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
* The request used to delete logstore from log service.
*
* @author log service dev
*/
class Aliyun_Log_Models_DeleteLogstoreRequest extends Aliyun_Log_Models_Request{
private $logstore;
/**
* Aliyun_Log_Models_DeleteLogstoreRequest constructor
*
* @param string $project project name
*/
public function __construct($project=null,$logstore = null) {
parent::__construct($project);
$this -> logstore = $logstore;
}
public function getLogstore()
{
return $this -> logstore;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_DeleteMachineGroupRequest extends Aliyun_Log_Models_Request {
private $groupName;
/**
* Aliyun_Log_Models_DeleteMachineGroupRequest Constructor
*
*/
public function __construct($groupName) {
$this->groupName = $groupName;
}
public function getGroupName(){
return $this->groupName;
}
public function setGroupName($groupName){
$this->groupName = $groupName;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_DeleteShardRequest extends Aliyun_Log_Models_Request {
private $logstore;
/**
* Aliyun_Log_Models_DeleteShardRequest Constructor
*
*/
public function __construct($project,$logstore,$shardId) {
parent::__construct ( $project );
$this->logstore = $logstore;
$this->shardId = $shardId;
}
public function getLogstore(){
return $this->logstore;
}
public function setLogstore($logstore){
$this->logstore = $logstore;
}
public function getShardId(){
return $this->shardId;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
class Aliyun_Log_Models_DeleteShipperRequest extends Aliyun_Log_Models_Request {
private $shipperName;
private $logStore;
/**
* @return mixed
*/
public function getLogStore()
{
return $this->logStore;
}
/**
* @param mixed $logStore
*/
public function setLogStore($logStore)
{
$this->logStore = $logStore;
}
/**
* @return mixed
*/
public function getShipperName()
{
return $this->shipperName;
}
/**
* @param mixed $shipperName
*/
public function setShipperName($shipperName)
{
$this->shipperName = $shipperName;
}
/**
* Aliyun_Log_Models_CreateShipperRequest Constructor
*
*/
public function __construct($project) {
parent::__construct ( $project );
}
}
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_GetACLRequest extends Aliyun_Log_Models_Request {
private $aclId;
/**
* Aliyun_Log_Models_GetACLRequest Constructor
*
*/
public function __construct($aclId=null) {
$this->aclId = $aclId;
}
public function getAclId(){
return $this->aclId;
}
public function setAclId($aclId){
$this->aclId = $aclId;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_GetConfigRequest extends Aliyun_Log_Models_Request {
private $configName;
/**
* Aliyun_Log_Models_GetConfigRequest Constructor
*
*/
public function __construct($configName = null) {
$this->configName = $configName;
}
public function getConfigName(){
return $this->configName;
}
public function setConfigName($configName){
$this->configName = $configName;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
* The request used to get cursor by fromTime or begin/end mode
*
* @author log service dev
*/
class Aliyun_Log_Models_GetCursorRequest extends Aliyun_Log_Models_Request {
/**
* @var string logstore name
*/
private $logstore;
/**
* @var string shard id
*/
private $shardId;
//mode and fromTime: choose one and another remains null
/**
* @var string value should be 'begin' or 'end'
* begin:return cursor point to first loggroup
* end:return cursor point to position after last loggroup
* if $mode is set to not null,$fromTime must be set null
*/
private $mode;
/**
* @var integer unix_timestamp
* return cursor point to first loggroup whose time after $fromTime
*/
private $fromTime;
/**
* Aliyun_Log_Models_GetCursorRequest Constructor
* @param string $project
* project name
* @param string $logstore
* logstore name
* @param string $shardId
* shard id
* @param string $mode
* query mode,value must be 'begin' or 'end'
* @param string $fromTime
* query by from time,unix_timestamp
*/
public function __construct($project,$logstore,$shardId,$mode=null,$fromTime=-1) {
parent::__construct ( $project );
$this->logstore = $logstore;
$this->shardId = $shardId;
$this->mode = $mode;
$this->fromTime = $fromTime;
}
/**
* Get logstore name
*
* @return string logstore name
*/
public function getLogstore(){
return $this->logstore;
}
/**
* Set logstore name
*
* @param string $logstore
* logstore name
*/
public function setLogstore($logstore){
$this->logstore = $logstore;
}
/**
* Get shard id
*
* @return string shard id
*/
public function getShardId(){
return $this->shardId;
}
/**
* Set shard id
*
* @param string $shardId
* shard id
*/
public function setShardId($shardId){
$this->shardId = $shardId;
}
/**
* Get mode
*
* @return string mode
*/
public function getMode(){
return $this->mode;
}
/**
* Set mode
*
* @param string $mode
* value must be 'begin' or 'end'
*/
public function setMode($mode){
$this->mode = $mode;
}
/**
* Get from time
*
* @return integer(unix_timestamp) from time
*/
public function getFromTime(){
return $this->fromTime;
}
/**
* Set from time
*
* @param integer $fromTime
* from time (unix_timestamp)
*/
public function setFromTime($fromTime){
$this->fromTime = $fromTime;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
* The request used to get histograms of a query from log service.
*
* @author log service dev
*/
class Aliyun_Log_Models_GetHistogramsRequest extends Aliyun_Log_Models_Request {
/**
* @var string logstore name
*/
private $logstore;
/**
* @var string topic name of logs
*/
private $topic;
/**
* @var integer the begin time
*/
private $from;
/**
* @var integer the end time
*/
private $to;
/**
* @var string user defined query
*/
private $query;
/**
* Aliyun_Log_Models_GetHistogramsRequest constructor
*
* @param string $project
* project name
* @param string $logstore
* logstore name
* @param integer $from
* the begin time
* @param integer $to
* the end time
* @param string $topic
* topic name of logs
* @param string $query
* user defined query
*/
public function __construct($project = null, $logstore = null, $from = null, $to = null, $topic = null, $query = null) {
parent::__construct ( $project );
$this->logstore = $logstore;
$this->from = $from;
$this->to = $to;
$this->topic = $topic;
$this->query = $query;
}
/**
* Get logstore name
*
* @return string logstore name
*/
public function getLogstore() {
return $this->logstore;
}
/**
* Set logstore name
*
* @param string $logstore
* logstore name
*/
public function setLogstore($logstore) {
$this->logstore = $logstore;
}
/**
* Get topic name
*
* @return string topic name
*/
public function getTopic() {
return $this->topic;
}
/**
* Set topic name
*
* @param string $topic
* topic name
*/
public function setTopic($topic) {
$this->topic = $topic;
}
/**
* Get begin time
*
* @return integer begin time
*/
public function getFrom() {
return $this->from;
}
/**
* Set begin time
*
* @param integer $from
* begin time
*/
public function setFrom($from) {
$this->from = $from;
}
/**
* Get end time
*
* @return integer end time
*/
public function getTo() {
return $this->to;
}
/**
* Set end time
*
* @param integer $to
* end time
*/
public function setTo($to) {
$this->to = $to;
}
/**
* Get user defined query
*
* @return string user defined query
*/
public function getQuery() {
return $this->query;
}
/**
* Set user defined query
*
* @param string $query
* user defined query
*/
public function setQuery($query) {
$this->query = $query;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
* The request used to get logs by a query from log service.
*
* @author log service dev
*/
class Aliyun_Log_Models_GetLogsRequest extends Aliyun_Log_Models_Request {
/**
* @var string logstore name
*/
private $logstore;
/**
* @var string topic name of logs
*/
private $topic;
/**
* @var integer the begin time
*/
private $from;
/**
* @var integer the end time
*/
private $to;
/**
* @var string user defined query
*/
private $query;
/**
* @var integer max line number of return logs
*/
private $line;
/**
* @var integer line offset of return logs
*/
private $offset;
/**
* @var bool if reverse is set to true, the query will return the latest logs first
*/
private $reverse;
/**
* Aliyun_Log_Models_GetLogsRequest Constructor
*
* @param string $project
* project name
* @param string $logStore
* logstore name
* @param integer $from
* the begin time
* @param integer $to
* the end time
* @param string $topic
* topic name of logs
* @param string $query
* user defined query
* @param integer $line
* query return line number
* @param integer $offset
* the log offset to return
* @param bool $reverse
* if reverse is set to true, the query will return the latest logs first
*/
public function __construct($project = null, $logstore = null, $from = null, $to = null, $topic = null, $query = null, $line = null, $offset = null, $reverse = null) {
parent::__construct ( $project );
$this->logstore = $logstore;
$this->from = $from;
$this->to = $to;
$this->topic = $topic;
$this->query = $query;
$this->line = $line;
$this->offset = $offset;
$this->reverse = $reverse;
}
/**
* Get logstore name
*
* @return string logstore name
*/
public function getLogstore() {
return $this->logstore;
}
/**
* Set logstore name
*
* @param string $logstore
* logstore name
*/
public function setLogstore($logstore) {
$this->logstore = $logstore;
}
/**
* Get topic name
*
* @return string topic name
*/
public function getTopic() {
return $this->topic;
}
/**
* Set topic name
*
* @param string $topic
* topic name
*/
public function setTopic($topic) {
$this->topic = $topic;
}
/**
* Get begin time
*
* @return integer begin time
*/
public function getFrom() {
return $this->from;
}
/**
* Set begin time
*
* @param integer $from
* begin time
*/
public function setFrom($from) {
$this->from = $from;
}
/**
* Get end time
*
* @return integer end time
*/
public function getTo() {
return $this->to;
}
/**
* Set end time
*
* @param integer $to
* end time
*/
public function setTo($to) {
$this->to = $to;
}
/**
* Get user defined query
*
* @return string user defined query
*/
public function getQuery() {
return $this->query;
}
/**
* Set user defined query
*
* @param string $query
* user defined query
*/
public function setQuery($query) {
$this->query = $query;
}
/**
* Get max line number of return logs
*
* @return integer max line number of return logs
*/
public function getLine() {
return $this->line;
}
/**
* Set max line number of return logs
*
* @param integer $line
* max line number of return logs
*/
public function setLine($line) {
$this->line = $line;
}
/**
* Get line offset of return logs
*
* @return integer line offset of return logs
*/
public function getOffset() {
return $this->offset;
}
/**
* Set request line offset of return logs
*
* @param integer $offset
* line offset of return logs
*/
public function setOffset($offset) {
$this->offset = $offset;
}
/**
* Get request reverse flag
*
* @return bool reverse flag
*/
public function getReverse() {
return $this->reverse;
}
/**
* Set request reverse flag
*
* @param bool $reverse
* reverse flag
*/
public function setReverse($reverse) {
$this->reverse = $reverse;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_GetMachineGroupRequest extends Aliyun_Log_Models_Request {
private $groupName;
/**
* Aliyun_Log_Models_GetMachineGroupRequest Constructor
*
*/
public function __construct($groupName=null) {
$this->groupName = $groupName;
}
public function getGroupName(){
return $this->groupName;
}
public function setGroupName($groupName){
$this->groupName = $groupName;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_GetMachineRequest extends Aliyun_Log_Models_Request {
private $uuid;
/**
* Aliyun_Log_Models_GetMachineRequest Constructor
*
*/
public function __construct($uuid=null) {
$this->uuid = $uuid;
}
public function getUuid(){
return $this->uuid;
}
public function setUuid($uuid){
$this->uuid = $uuid;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
* The request used to get logs by a query from log service.
*
* @author log service dev
*/
class Aliyun_Log_Models_GetProjectLogsRequest extends Aliyun_Log_Models_Request {
/**
* @var string user defined query
*/
private $query;
/**
* Aliyun_Log_Models_GetProjectLogsRequest Constructor
* @param string $query
* user defined query
*/
public function __construct($project = null, $query = null ) {
parent::__construct ( $project );
$this->query = $query;
}
/**
* Get user defined query
*
* @return string user defined query
*/
public function getQuery() {
return $this->query;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
class Aliyun_Log_Models_GetShipperConfigRequest extends Aliyun_Log_Models_Request {
private $shipperName;
private $logStore;
/**
* @return mixed
*/
public function getLogStore()
{
return $this->logStore;
}
/**
* @param mixed $logStore
*/
public function setLogStore($logStore)
{
$this->logStore = $logStore;
}
/**
* @return mixed
*/
public function getShipperName()
{
return $this->shipperName;
}
/**
* @param mixed $shipperName
*/
public function setShipperName($shipperName)
{
$this->shipperName = $shipperName;
}
/**
* Aliyun_Log_Models_CreateShipperRequest Constructor
*
*/
public function __construct($project) {
parent::__construct ( $project );
}
}
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
class Aliyun_Log_Models_GetShipperTasksRequest extends Aliyun_Log_Models_Request{
private $shipperName;
private $logStore;
private $startTime;
private $endTime;
/**
* @var support one of ['', 'fail', 'success', 'running'] , if the status_type = '' , return all kinds of status type
*/
private $statusType;
private $offset;
private $size;
/**
* @return mixed
*/
public function getStartTime()
{
return $this->startTime;
}
/**
* @param mixed $startTime
*/
public function setStartTime($startTime)
{
$this->startTime = $startTime;
}
/**
* @return mixed
*/
public function getEndTime()
{
return $this->endTime;
}
/**
* @param mixed $endTime
*/
public function setEndTime($endTime)
{
$this->endTime = $endTime;
}
/**
* @return
*/
public function getStatusType()
{
return $this->statusType;
}
/**
* @param $statusType
*/
public function setStatusType($statusType)
{
$this->statusType = $statusType;
}
/**
* @return mixed
*/
public function getOffset()
{
return $this->offset;
}
/**
* @param mixed $offset
*/
public function setOffset($offset)
{
$this->offset = $offset;
}
/**
* @return mixed
*/
public function getSize()
{
return $this->size;
}
/**
* @param mixed $size
*/
public function setSize($size)
{
$this->size = $size;
}
/**
* @return mixed
*/
public function getLogStore()
{
return $this->logStore;
}
/**
* @param mixed $logStore
*/
public function setLogStore($logStore)
{
$this->logStore = $logStore;
}
/**
* @return mixed
*/
public function getShipperName()
{
return $this->shipperName;
}
/**
* @param mixed $shipperName
*/
public function setShipperName($shipperName)
{
$this->shipperName = $shipperName;
}
/**
* Aliyun_Log_Models_CreateShipperRequest Constructor
*
*/
public function __construct($project) {
parent::__construct ( $project );
}
}
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_ListACLsRequest extends Aliyun_Log_Models_Request {
private $offset;
private $size;
private $principleId;
/**
* Aliyun_Log_Models_ListACLsRequest Constructor
*
*/
public function __construct($principleId=null,$offset=null,$size=null) {
$this->offset = $offset;
$this->size = $size;
$this->principleId = $principleId;
}
public function getOffset(){
return $this->offset;
}
public function setOffset($offset){
$this->offset = $offset;
}
public function getSize(){
return $this->size;
}
public function setSize($size){
$this->size = $size;
}
public function getPrincipleId(){
return $this->principleId;
}
public function setPrincipleId($principleId){
$this->principleId = $principleId;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_ListConfigsRequest extends Aliyun_Log_Models_Request {
private $configName;
private $offset;
private $size;
/**
* Aliyun_Log_Models_ListConfigsRequest Constructor
*
*/
public function __construct($configName=null,$offset=null,$size=null) {
//parent::__construct ( $project );
$this->configName = $configName;
$this->offset = $offset;
$this->size = $size;
}
public function getConfigName(){
return $this->configName;
}
public function setConfigName($configName){
$this->configName = $configName;
}
public function getOffset(){
return $this->offset;
}
public function setOffset($offset){
$this->offset = $offset;
}
public function getSize(){
return $this->size;
}
public function setSize($size){
$this->size = $size;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
* The request used to list logstore from log service.
*
* @author log service dev
*/
class Aliyun_Log_Models_ListLogstoresRequest extends Aliyun_Log_Models_Request{
/**
* Aliyun_Log_Models_ListLogstoresRequest constructor
*
* @param string $project project name
*/
public function __construct($project=null) {
parent::__construct($project);
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_ListMachineGroupsRequest extends Aliyun_Log_Models_Request {
private $groupName;
private $offset;
private $size;
/**
* Aliyun_Log_Models_ListMachineGroupsRequest Constructor
*
*/
public function __construct($groupName=null,$offset=null,$size=null) {
$this->groupName = $groupName;
$this->offset = $offset;
$this->size = $size;
}
public function getGroupName(){
return $this->groupName;
}
public function setGroupName($groupName){
$this->groupName = $groupName;
}
public function getOffset(){
return $this->offset;
}
public function setOffset($offset){
$this->offset = $offset;
}
public function getSize(){
return $this->size;
}
public function setSize($size){
$this->size = $size;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_ListShardsRequest extends Aliyun_Log_Models_Request {
private $logstore;
/**
* Aliyun_Log_Models_ListShardsRequest Constructor
*
*/
public function __construct($project,$logstore) {
parent::__construct ( $project );
$this->logstore = $logstore;
}
public function getLogstore(){
return $this->logstore;
}
public function setLogstore($logstore){
$this->logstore = $logstore;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
class Aliyun_Log_Models_ListShipperRequest extends Aliyun_Log_Models_Request{
private $logStore;
/**
* Aliyun_Log_Models_CreateShipperRequest Constructor
*
*/
public function __construct($project) {
parent::__construct ( $project );
}
/**
* @return mixed
*/
public function getLogStore()
{
return $this->logStore;
}
/**
* @param mixed $logStore
*/
public function setLogStore($logStore)
{
$this->logStore = $logStore;
}
}
\ No newline at end of file
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
* The Request used to list topics from log service.
*
* @author log service dev
*/
class Aliyun_Log_Models_ListTopicsRequest extends Aliyun_Log_Models_Request {
/**
* @var string $logstore logstore name
*/
private $logstore;
/**
* @var string $token the start token to list topics
*/
private $token;
/**
* @var integer $line max topic counts to return
*/
private $line;
/**
* Aliyun_Log_Models_ListTopicsRequest constructor
*
* @param string $project project name
* @param string $logstore logstore name
* @param string $token the start token to list topics
* @param integer $line max topic counts to return
*/
public function __construct($project=null, $logstore=null, $token=null, $line=null) {
parent::__construct($project);
$this->logstore = $logstore;
$this->token = $token;
$this->line = $line;
}
/**
* Get logstroe name
*
* @return string logstore name
*/
public function getLogstore() {
return $this->logstore;
}
/**
* Set logstore name
*
* @param string $logstore
* logstore name
*/
public function setLogstore($logstore) {
$this->logstore = $logstore;
}
/**
* Get start token to list topics
*
* @return string start token to list topics
*/
public function getToken() {
return $this->token;
}
/**
* Set start token to list topics
*
* @param string $token start token to list topics
*/
public function setToken($token) {
$this->token = $token;
}
/**
* Get max topic counts to return
*
* @return integer max topic counts to return
*/
public function getLine() {
return $this->line;
}
/**
* Set max topic counts to return
*
* @param integer $line max topic counts to return
*/
public function setLine($line) {
$this->line = $line;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
*
*
* @author log service dev
*/
class Aliyun_Log_Models_MergeShardsRequest extends Aliyun_Log_Models_Request {
private $logstore;
/**
* Aliyun_Log_Models_MergeShardsRequest Constructor
*
*/
public function __construct($project,$logstore,$shardId) {
parent::__construct ( $project );
$this->logstore = $logstore;
$this->shardId = $shardId;
}
public function getLogstore(){
return $this->logstore;
}
public function setLogstore($logstore){
$this->logstore = $logstore;
}
public function getShardId(){
return $this->shardId;
}
}
... ...
<?php
/**
* Copyright (C) Alibaba Cloud Computing
* All rights reserved
*/
require_once realpath(dirname(__FILE__) . '/Request.php');
/**
* The request used to send data to log server.
*
* @author log service dev
*/
class Aliyun_Log_Models_PutLogsRequest extends Aliyun_Log_Models_Request {
/**
* @var string logstore name
*/
private $logstore;
/**
* @var string topic name
*/
private $topic;
/**
* @var string source of the logs
*/
private $source;
/**
* @var array LogItem array, log data
*/
private $logitems;
/**
* @var string shardKey putlogs shard hash key
*/
private $shardKey;
/**
* Aliyun_Log_Models_PutLogsRequest cnstructor
*
* @param string $project
* project name
* @param string $logstore
* logstore name
* @param string $topic
* topic name
* @param string $source
* source of the log
* @param array $logitems
* LogItem array,log data
*/
public function __construct($project = null, $logstore = null, $topic = null, $source = null, $logitems = null,$shardKey=null) {
parent::__construct ( $project );
$this->logstore = $logstore;
$this->topic = $topic;
$this->source = $source;
$this->logitems = $logitems;
$this->shardKey = $shardKey;
}
/**
* Get logstroe name
*
* @return string logstore name
*/
public function getLogstore() {
return $this->logstore;
}
/**
* Set logstore name
*
* @param string $logstore
* logstore name
*/
public function setLogstore($logstore) {
$this->logstore = $logstore;
}
/**
* Get topic name
*
* @return string topic name
*/
public function getTopic() {
return $this->topic;
}
/**
* Set topic name
*
* @param string $topic
* topic name
*/
public function setTopic($topic) {
$this->topic = $topic;
}
/**
* Get all the log data
*
* @return array LogItem array, log data
*/
public function getLogItems() {
return $this->logitems;
}
/**
* Set the log data
*
* @param array $logitems
* LogItem array, log data
*/
public function setLogItems($logitems) {
$this->logitems = $logitems;
}
/**
* Get log source
*
* @return string log source
*/
public function getSource() {
return $this->source;
}
/**
* set log source
*
* @param string $source
* log source
*/
public function setSource($source) {
$this->source = $source;
}
/**
* set shard key
*
* @param string shardkey
*/
public function setShardKey($key){
$this -> shardKey=$key;
}
/**
* get shard key
*
* @return string shardKey
*/
public function getShardKey(){
return $this ->shardKey;
}
}
... ...