From 41ff2925f652b340c87aa8fad46ce96feaad107a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E7=88=BD?= <996190264@qq.com> Date: Tue, 19 Jul 2022 13:07:38 +0800 Subject: [PATCH] =?UTF-8?q?Log=E7=B1=BB=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Aliyun/Log/Client.php | 134 +++++++++++++++++++-------------------- Aliyun/Log/log.proto.php | 100 ++++++++++++++--------------- Aliyun/Log/sls.proto.php | 4 +- 3 files changed, 119 insertions(+), 119 deletions(-) diff --git a/Aliyun/Log/Client.php b/Aliyun/Log/Client.php index 2a832b6..1e847ec 100644 --- a/Aliyun/Log/Client.php +++ b/Aliyun/Log/Client.php @@ -27,7 +27,7 @@ class Aliyun_Log_Client { * @var string aliyun accessKey */ protected $accessKey; - + /** * @var string aliyun accessKeyId */ @@ -62,7 +62,7 @@ class Aliyun_Log_Client { * @var string the local machine ip address. */ protected $source; - + /** * Aliyun_Log_Client constructor * @@ -99,35 +99,35 @@ private function setEndpoint($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. + * 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 */ @@ -146,28 +146,28 @@ protected function getHttpResponse($method, $url, $body, $headers) { $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 ) = + 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'], + throw new Aliyun_Log_Exception ( $exJson ['error_code'], $exJson ['error_message'], $requestId ); } else { if ($exJson) { @@ -180,7 +180,7 @@ private function sendRequest($method, $url, $body, $headers) { } } } - + /** * @return array * @throws Aliyun_Log_Exception @@ -196,7 +196,7 @@ private function send($method, $project, $body, $resource, $params, $headers) { $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) @@ -206,7 +206,7 @@ private function send($method, $project, $body, $resource, $params, $headers) { $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 ); @@ -215,11 +215,11 @@ private function send($method, $project, $body, $resource, $params, $headers) { else{ if(is_null($project)) $url = "http://$this->endpoint$url"; - else $url = "http://$project.$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. @@ -231,18 +231,18 @@ private function send($method, $project, $body, $resource, $params, $headers) { 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 = new Aliyun_Log(); $log->setTime ( $logItem->getTime () ); $content = $logItem->getContents (); foreach ( $content as $key => $value ) { @@ -257,7 +257,7 @@ public function putLogs(Aliyun_Log_Models_PutLogsRequest $request) { $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." ); @@ -267,7 +267,7 @@ public function putLogs(Aliyun_Log_Models_PutLogsRequest $request) { $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(); @@ -434,7 +434,7 @@ public function listShipper(Aliyun_Log_Models_ListShipperRequest $request){ } /** - * create logstore + * create logstore * Unsuccessful opertaion will cause an Aliyun_Log_Exception. * * @param Aliyun_Log_Models_CreateLogstoreRequest $request the CreateLogStore request parameters class. @@ -461,7 +461,7 @@ public function createLogstore(Aliyun_Log_Models_CreateLogstoreRequest $request) return new Aliyun_Log_Models_CreateLogstoreResponse($resp,$header); } /** - * update logstore + * update logstore * Unsuccessful opertaion will cause an Aliyun_Log_Exception. * * @param Aliyun_Log_Models_UpdateLogstoreRequest $request the UpdateLogStore request parameters class. @@ -578,7 +578,7 @@ public function getHistogramsJson(Aliyun_Log_Models_GetHistogramsRequest $reques $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. @@ -631,7 +631,7 @@ public function getLogsJson(Aliyun_Log_Models_GetLogsRequest $request) { 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. @@ -751,7 +751,7 @@ public function executeProjectSql(Aliyun_Log_Models_ProjectSqlRequest $request) /** * create sql instance api * Unsuccessful opertaion will cause an Aliyun_Log_Exception. - * @param $project is project name + * @param $project is project name * @param $cu is max cores used concurrently in a project * @throws Aliyun_Log_Exception * @return Aliyun_Log_Models_CreateSqlInstanceResponse @@ -767,17 +767,17 @@ public function createSqlInstance($project, $cu) "cu"=>$cu ); $body_str = json_encode($body); - list($resp,$header) = $this -> send("POST",$project,$body_str,$resource,$params,$headers); + 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_CreateSqlInstanceResponse($resp,$header); + return new Aliyun_Log_Models_CreateSqlInstanceResponse($resp,$header); } - + /** * update sql instance api * Unsuccessful opertaion will cause an Aliyun_Log_Exception. - * @param $project is project name + * @param $project is project name * @param $cu is max cores used concurrently in a project * @throws Aliyun_Log_Exception * @return Aliyun_Log_Models_UpdateSqlInstanceResponse @@ -793,16 +793,16 @@ public function updateSqlInstance($project, $cu) "cu"=>$cu ); $body_str = json_encode($body); - list($resp,$header) = $this -> send("PUT",$project,$body_str,$resource,$params,$headers); + 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_UpdateSqlInstanceResponse($resp,$header); + return new Aliyun_Log_Models_UpdateSqlInstanceResponse($resp,$header); } /** * get sql instance api * Unsuccessful opertaion will cause an Aliyun_Log_Exception. - * @param $project is project name + * @param $project is project name * @throws Aliyun_Log_Exception * @return Aliyun_Log_Models_UpdateSqlInstanceResponse */ @@ -814,11 +814,11 @@ public function listSqlInstance($project) $params = array(); $resource = '/sqlinstance'; $body_str = ""; - list($resp,$header) = $this -> send("GET",$project,$body_str,$resource,$params,$headers); + list($resp,$header) = $this -> send("GET",$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_ListSqlInstanceResponse($resp,$header); + return new Aliyun_Log_Models_ListSqlInstanceResponse($resp,$header); } /** @@ -850,7 +850,7 @@ public function batchGetLogs(Aliyun_Log_Models_BatchGetLogsRequest $request) { //$resp is a byteArray $resp = gzuncompress($resp); if($resp===false)$resp = new LogGroupList(); - + else { $resp = new LogGroupList($resp); } @@ -872,7 +872,7 @@ public function listShards(Aliyun_Log_Models_ListShardsRequest $request) { $logstore = $request->getLogstore()!==null?$request->getLogstore():''; $resource='/logstores/'.$logstore.'/shards'; - list($resp,$header) = $this->send("GET",$project,NULL,$resource,$params,$headers); + 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 ); @@ -897,7 +897,7 @@ public function splitShard(Aliyun_Log_Models_SplitShardRequest $request) { $resource='/logstores/'.$logstore.'/shards/'.$shardId; $params["action"] = "split"; $params["key"] = $midHash; - list($resp,$header) = $this->send("POST",$project,NULL,$resource,$params,$headers); + 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 ); @@ -919,7 +919,7 @@ public function MergeShards(Aliyun_Log_Models_MergeShardsRequest $request) { $resource='/logstores/'.$logstore.'/shards/'.$shardId; $params["action"] = "merge"; - list($resp,$header) = $this->send("POST",$project,NULL,$resource,$params,$headers); + 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 ); @@ -940,7 +940,7 @@ public function DeleteShard(Aliyun_Log_Models_DeleteShardRequest $request) { $shardId = $request -> getShardId()!= null ? $request -> getShardId():-1; $resource='/logstores/'.$logstore.'/shards/'.$shardId; - list($resp,$header) = $this->send("DELETE",$project,NULL,$resource,$params,$headers); + 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 ); } @@ -976,7 +976,7 @@ public function getCursor(Aliyun_Log_Models_GetCursorRequest $request){ 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); + 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); @@ -991,7 +991,7 @@ public function createConfig(Aliyun_Log_Models_CreateConfigRequest $request){ } $headers ['Content-Type'] = 'application/json'; $resource = '/configs'; - list($resp,$header) = $this->send("POST",NULL,$body,$resource,$params,$headers); + list($resp,$header) = $this->send("POST",NULL,$body,$resource,$params,$headers); return new Aliyun_Log_Models_CreateConfigResponse($header); } @@ -1006,7 +1006,7 @@ public function updateConfig(Aliyun_Log_Models_UpdateConfigRequest $request){ } $headers ['Content-Type'] = 'application/json'; $resource = '/configs/'.$configName; - list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers); + list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers); return new Aliyun_Log_Models_UpdateConfigResponse($header); } @@ -1015,9 +1015,9 @@ public function getConfig(Aliyun_Log_Models_GetConfigRequest $request){ $headers = array(); $configName = ($request->getConfigName()!==null)?$request->getConfigName():''; - + $resource = '/configs/'.$configName; - list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers); + 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); @@ -1028,7 +1028,7 @@ public function deleteConfig(Aliyun_Log_Models_DeleteConfigRequest $request){ $headers = array(); $configName = ($request->getConfigName()!==null)?$request->getConfigName():''; $resource = '/configs/'.$configName; - list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers); + list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers); return new Aliyun_Log_Models_DeleteConfigResponse($header); } @@ -1041,12 +1041,12 @@ public function listConfigs(Aliyun_Log_Models_ListConfigsRequest $request){ if($request->getSize()!==null)$params['size'] = $request->getSize(); $resource = '/configs'; - list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers); + 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(); @@ -1056,7 +1056,7 @@ public function createMachineGroup(Aliyun_Log_Models_CreateMachineGroupRequest $ } $headers ['Content-Type'] = 'application/json'; $resource = '/machinegroups'; - list($resp,$header) = $this->send("POST",NULL,$body,$resource,$params,$headers); + list($resp,$header) = $this->send("POST",NULL,$body,$resource,$params,$headers); return new Aliyun_Log_Models_CreateMachineGroupResponse($header); } @@ -1072,7 +1072,7 @@ public function updateMachineGroup(Aliyun_Log_Models_UpdateMachineGroupRequest $ } $headers ['Content-Type'] = 'application/json'; $resource = '/machinegroups/'.$groupName; - list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers); + list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers); return new Aliyun_Log_Models_UpdateMachineGroupResponse($header); } @@ -1081,9 +1081,9 @@ public function getMachineGroup(Aliyun_Log_Models_GetMachineGroupRequest $reques $headers = array(); $groupName = ($request->getGroupName()!==null)?$request->getGroupName():''; - + $resource = '/machinegroups/'.$groupName; - list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers); + 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); @@ -1095,7 +1095,7 @@ public function deleteMachineGroup(Aliyun_Log_Models_DeleteMachineGroupRequest $ $groupName = ($request->getGroupName()!==null)?$request->getGroupName():''; $resource = '/machinegroups/'.$groupName; - list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers); + list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers); return new Aliyun_Log_Models_DeleteMachineGroupResponse($header); } @@ -1108,7 +1108,7 @@ public function listMachineGroups(Aliyun_Log_Models_ListMachineGroupsRequest $re if($request->getSize()!==null)$params['size'] = $request->getSize(); $resource = '/machinegroups'; - list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers); + 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 ); @@ -1122,7 +1122,7 @@ public function applyConfigToMachineGroup(Aliyun_Log_Models_ApplyConfigToMachine $groupName=$request->getGroupName(); $headers ['Content-Type'] = 'application/json'; $resource = '/machinegroups/'.$groupName.'/configs/'.$configName; - list($resp,$header) = $this->send("PUT",NULL,NULL,$resource,$params,$headers); + list($resp,$header) = $this->send("PUT",NULL,NULL,$resource,$params,$headers); return new Aliyun_Log_Models_ApplyConfigToMachineGroupResponse($header); } @@ -1133,7 +1133,7 @@ public function removeConfigFromMachineGroup(Aliyun_Log_Models_RemoveConfigFromM $groupName=$request->getGroupName(); $headers ['Content-Type'] = 'application/json'; $resource = '/machinegroups/'.$groupName.'/configs/'.$configName; - list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers); + list($resp,$header) = $this->send("DELETE",NULL,NULL,$resource,$params,$headers); return new Aliyun_Log_Models_RemoveConfigFromMachineGroupResponse($header); } @@ -1176,33 +1176,33 @@ public function updateACL(Aliyun_Log_Models_UpdateACLRequest $request){ } $headers ['Content-Type'] = 'application/json'; $resource = '/acls/'.$aclId; - list($resp,$header) = $this->send("PUT",NULL,$body,$resource,$params,$headers); + 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); + 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); + 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(); @@ -1211,7 +1211,7 @@ public function listACLs(Aliyun_Log_Models_ListACLsRequest $request){ if($request->getSize()!==null)$params['size'] = $request->getSize(); $resource = '/acls'; - list($resp,$header) = $this->send("GET",NULL,NULL,$resource,$params,$headers); + 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); diff --git a/Aliyun/Log/log.proto.php b/Aliyun/Log/log.proto.php index 2d8b952..c3e41cd 100644 --- a/Aliyun/Log/log.proto.php +++ b/Aliyun/Log/log.proto.php @@ -5,7 +5,7 @@ // message Log.Content class Log_Content { private $_unknown; - + function __construct($in = NULL, &$limit = PHP_INT_MAX) { if($in !== NULL) { if (is_string($in)) { @@ -20,7 +20,7 @@ function __construct($in = NULL, &$limit = PHP_INT_MAX) { $this->read($fp, $limit); } } - + function read($fp, &$limit = PHP_INT_MAX) { while(!feof($fp) && $limit > 0) { $tag = Protobuf::read_varint($fp, $limit); @@ -64,7 +64,7 @@ function read($fp, &$limit = PHP_INT_MAX) { if (!$this->validateRequired()) throw new Exception('Required fields are missing'); } - + function write($fp) { if (!$this->validateRequired()) throw new Exception('Required fields are missing'); @@ -79,7 +79,7 @@ function write($fp) { fwrite($fp, $this->value_); } } - + public function size() { $size = 0; if (!is_null($this->key_)) { @@ -92,20 +92,20 @@ public function size() { } return $size; } - + public function validateRequired() { if ($this->key_ === null) return false; if ($this->value_ === null) return false; return true; } - + public function __toString() { return '' . Protobuf::toString('unknown', $this->_unknown) . Protobuf::toString('key_', $this->key_) . Protobuf::toString('value_', $this->value_); } - + // required string key = 1; private $key_ = null; @@ -113,7 +113,7 @@ public function clearKey() { $this->key_ = null; } public function hasKey() { return $this->key_ !== null; } public function getKey() { if($this->key_ === null) return ""; else return $this->key_; } public function setKey($value) { $this->key_ = $value; } - + // required string value = 2; private $value_ = null; @@ -121,14 +121,14 @@ public function clearValue() { $this->value_ = null; } public function hasValue() { return $this->value_ !== null; } public function getValue() { if($this->value_ === null) return ""; else return $this->value_; } public function setValue($value) { $this->value_ = $value; } - + // @@protoc_insertion_point(class_scope:Log.Content) } // message Log -class Log { +class Aliyun_Log { private $_unknown; - + function __construct($in = NULL, &$limit = PHP_INT_MAX) { if($in !== NULL) { if (is_string($in)) { @@ -143,7 +143,7 @@ function __construct($in = NULL, &$limit = PHP_INT_MAX) { $this->read($fp, $limit); } } - + function read($fp, &$limit = PHP_INT_MAX) { while(!feof($fp) && $limit > 0) { $tag = Protobuf::read_varint($fp, $limit); @@ -158,7 +158,7 @@ function read($fp, &$limit = PHP_INT_MAX) { if ($tmp === false) throw new Exception('Protobuf::read_varint returned false'); $this->time_ = $tmp; - + break; case 2: ASSERT('$wire == 2'); @@ -176,7 +176,7 @@ function read($fp, &$limit = PHP_INT_MAX) { if (!$this->validateRequired()) throw new Exception('Required fields are missing'); } - + function write($fp) { if (!$this->validateRequired()) throw new Exception('Required fields are missing'); @@ -191,7 +191,7 @@ function write($fp) { $v->write($fp); } } - + public function size() { $size = 0; if (!is_null($this->time_)) { @@ -204,19 +204,19 @@ public function size() { } return $size; } - + public function validateRequired() { if ($this->time_ === null) return false; return true; } - + public function __toString() { return '' . Protobuf::toString('unknown', $this->_unknown) . Protobuf::toString('time_', $this->time_) . Protobuf::toString('contents_', $this->contents_); } - + // required uint32 time = 1; private $time_ = null; @@ -224,7 +224,7 @@ public function clearTime() { $this->time_ = null; } public function hasTime() { return $this->time_ !== null; } public function getTime() { if($this->time_ === null) return 0; else return $this->time_; } public function setTime($value) { $this->time_ = $value; } - + // repeated .Log.Content contents = 2; private $contents_ = null; @@ -235,14 +235,14 @@ public function getContentsArray() { if ($this->contents_ === null ) return arra public function setContents($index, $value) {$this->contents_[$index] = $value; } public function addContents($value) { $this->contents_[] = $value; } public function addAllContents(array $values) { foreach($values as $value) {$this->contents_[] = $value;} } - + // @@protoc_insertion_point(class_scope:Log) } // message LogGroup class LogGroup { private $_unknown; - + function __construct($in = NULL, &$limit = PHP_INT_MAX) { if($in !== NULL) { if (is_string($in)) { @@ -257,7 +257,7 @@ function __construct($in = NULL, &$limit = PHP_INT_MAX) { $this->read($fp, $limit); } } - + function read($fp, &$limit = PHP_INT_MAX) { while(!feof($fp) && $limit > 0) { $tag = Protobuf::read_varint($fp, $limit); @@ -272,7 +272,7 @@ function read($fp, &$limit = PHP_INT_MAX) { if ($len === false) throw new Exception('Protobuf::read_varint returned false'); $limit-=$len; - $this->logs_[] = new Log($fp, $len); + $this->logs_[] = new Aliyun_Log($fp, $len); ASSERT('$len == 0'); break; case 2: @@ -324,7 +324,7 @@ function read($fp, &$limit = PHP_INT_MAX) { if (!$this->validateRequired()) throw new Exception('Required fields are missing'); } - + function write($fp) { if (!$this->validateRequired()) throw new Exception('Required fields are missing'); @@ -350,7 +350,7 @@ function write($fp) { fwrite($fp, $this->source_); } } - + public function size() { $size = 0; if (!is_null($this->logs_)) @@ -372,11 +372,11 @@ public function size() { } return $size; } - + public function validateRequired() { return true; } - + public function __toString() { return '' . Protobuf::toString('unknown', $this->_unknown) @@ -385,7 +385,7 @@ public function __toString() { . Protobuf::toString('topic_', $this->topic_) . Protobuf::toString('source_', $this->source_); } - + // repeated .Log logs = 1; private $logs_ = null; @@ -396,7 +396,7 @@ public function getLogsArray() { if ($this->logs_ === null ) return array(); els public function setLogs($index, $value) {$this->logs_[$index] = $value; } public function addLogs($value) { $this->logs_[] = $value; } public function addAllLogs(array $values) { foreach($values as $value) {$this->logs_[] = $value;} } - + // optional string reserved = 2; private $reserved_ = null; @@ -404,7 +404,7 @@ public function clearReserved() { $this->reserved_ = null; } public function hasReserved() { return $this->reserved_ !== null; } public function getReserved() { if($this->reserved_ === null) return ""; else return $this->reserved_; } public function setReserved($value) { $this->reserved_ = $value; } - + // optional string topic = 3; private $topic_ = null; @@ -412,7 +412,7 @@ public function clearTopic() { $this->topic_ = null; } public function hasTopic() { return $this->topic_ !== null; } public function getTopic() { if($this->topic_ === null) return ""; else return $this->topic_; } public function setTopic($value) { $this->topic_ = $value; } - + // optional string source = 4; private $source_ = null; @@ -420,14 +420,14 @@ public function clearSource() { $this->source_ = null; } public function hasSource() { return $this->source_ !== null; } public function getSource() { if($this->source_ === null) return ""; else return $this->source_; } public function setSource($value) { $this->source_ = $value; } - + // @@protoc_insertion_point(class_scope:LogGroup) } // message LogPackage class LogPackage { private $_unknown; - + function __construct($in = NULL, &$limit = PHP_INT_MAX) { if($in !== NULL) { if (is_string($in)) { @@ -442,7 +442,7 @@ function __construct($in = NULL, &$limit = PHP_INT_MAX) { $this->read($fp, $limit); } } - + function read($fp, &$limit = PHP_INT_MAX) { while(!feof($fp) && $limit > 0) { $tag = Protobuf::read_varint($fp, $limit); @@ -471,7 +471,7 @@ function read($fp, &$limit = PHP_INT_MAX) { if ($tmp === false) throw new Exception('Protobuf::read_varint returned false'); $this->uncompressSize_ = $tmp; - + break; default: $this->_unknown[$field . '-' . Protobuf::get_wiretype($wire)][] = Protobuf::read_field($fp, $wire, $limit); @@ -480,7 +480,7 @@ function read($fp, &$limit = PHP_INT_MAX) { if (!$this->validateRequired()) throw new Exception('Required fields are missing'); } - + function write($fp) { if (!$this->validateRequired()) throw new Exception('Required fields are missing'); @@ -494,7 +494,7 @@ function write($fp) { Protobuf::write_varint($fp, $this->uncompressSize_); } } - + public function size() { $size = 0; if (!is_null($this->data_)) { @@ -506,19 +506,19 @@ public function size() { } return $size; } - + public function validateRequired() { if ($this->data_ === null) return false; return true; } - + public function __toString() { return '' . Protobuf::toString('unknown', $this->_unknown) . Protobuf::toString('data_', $this->data_) . Protobuf::toString('uncompressSize_', $this->uncompressSize_); } - + // required bytes data = 1; private $data_ = null; @@ -526,7 +526,7 @@ public function clearData() { $this->data_ = null; } public function hasData() { return $this->data_ !== null; } public function getData() { if($this->data_ === null) return ""; else return $this->data_; } public function setData($value) { $this->data_ = $value; } - + // optional int32 uncompress_size = 2; private $uncompressSize_ = null; @@ -534,14 +534,14 @@ public function clearUncompressSize() { $this->uncompressSize_ = null; } public function hasUncompressSize() { return $this->uncompressSize_ !== null; } public function getUncompressSize() { if($this->uncompressSize_ === null) return 0; else return $this->uncompressSize_; } public function setUncompressSize($value) { $this->uncompressSize_ = $value; } - + // @@protoc_insertion_point(class_scope:LogPackage) } // message LogPackageList class LogPackageList { private $_unknown; - + function __construct($in = NULL, &$limit = PHP_INT_MAX) { if($in !== NULL) { if (is_string($in)) { @@ -556,7 +556,7 @@ function __construct($in = NULL, &$limit = PHP_INT_MAX) { $this->read($fp, $limit); } } - + function read($fp, &$limit = PHP_INT_MAX) { while(!feof($fp) && $limit > 0) { $tag = Protobuf::read_varint($fp, $limit); @@ -581,7 +581,7 @@ function read($fp, &$limit = PHP_INT_MAX) { if (!$this->validateRequired()) throw new Exception('Required fields are missing'); } - + function write($fp) { if (!$this->validateRequired()) throw new Exception('Required fields are missing'); @@ -592,7 +592,7 @@ function write($fp) { $v->write($fp); } } - + public function size() { $size = 0; if (!is_null($this->packages_)) @@ -602,17 +602,17 @@ public function size() { } return $size; } - + public function validateRequired() { return true; } - + public function __toString() { return '' . Protobuf::toString('unknown', $this->_unknown) . Protobuf::toString('packages_', $this->packages_); } - + // repeated .LogPackage packages = 1; private $packages_ = null; @@ -623,7 +623,7 @@ public function getPackagesArray() { if ($this->packages_ === null ) return arra public function setPackages($index, $value) {$this->packages_[$index] = $value; } public function addPackages($value) { $this->packages_[] = $value; } public function addAllPackages(array $values) { foreach($values as $value) {$this->packages_[] = $value;} } - + // @@protoc_insertion_point(class_scope:LogPackageList) } diff --git a/Aliyun/Log/sls.proto.php b/Aliyun/Log/sls.proto.php index 84e8189..0dbad62 100644 --- a/Aliyun/Log/sls.proto.php +++ b/Aliyun/Log/sls.proto.php @@ -126,7 +126,7 @@ public function setValue($value) { $this->value_ = $value; } } // message Log -class Log { +class Aliyun_Log { private $_unknown; function __construct($in = NULL, &$limit = PHP_INT_MAX) { @@ -272,7 +272,7 @@ function read($fp, &$limit = PHP_INT_MAX) { if ($len === false) throw new Exception('Protobuf::read_varint returned false'); $limit-=$len; - $this->logs_[] = new Log($fp, $len); + $this->logs_[] = new Aliyun_Log($fp, $len); ASSERT('$len == 0'); break; case 2: