MachineGroup.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <?php
  2. /**
  3. * Copyright (C) Alibaba Cloud Computing
  4. * All rights reserved
  5. */
  6. class Aliyun_Log_Models_MachineGroup_GroupAttribute {
  7. public $externalName;
  8. public $groupTopic;
  9. public function __construct($externalName=null,$groupTopic=null){
  10. $this->externalName = $externalName;
  11. $this->groupTopic = $groupTopic;
  12. }
  13. public function toArray(){
  14. $resArray = array();
  15. if($this->externalName!==null)
  16. $resArray['externalName'] = $this->externalName;
  17. if($this->groupTopic!==null)
  18. $resArray['groupTopic'] = $this->groupTopic;
  19. return $resArray;
  20. }
  21. }
  22. class Aliyun_Log_Models_MachineGroup {
  23. private $groupName;
  24. private $groupType;
  25. private $groupAttribute;
  26. private $machineList;
  27. private $createTime;
  28. private $lastModifyTime;
  29. public function __construct($groupName='',$groupType='',$groupAttribute=null,
  30. $machineList=null,$createTime=null,$lastModifyTime=null) {
  31. $this->groupName = $groupName;
  32. $this->groupType = $groupType;
  33. $this->groupAttribute = $groupAttribute;
  34. $this->machineList = $machineList;
  35. $this->createTime = $createTime;
  36. $this->lastModifyTime = $lastModifyTime;
  37. }
  38. public function getGroupName(){
  39. return $this->groupName;
  40. }
  41. public function setGroupName($groupName){
  42. $this->groupName = $groupName;
  43. }
  44. public function getGroupType(){
  45. return $this->groupType;
  46. }
  47. public function setGroupType($groupType){
  48. $this->groupType = $groupType;
  49. }
  50. public function getGroupAttribute(){
  51. return $this->groupAttribute;
  52. }
  53. public function setGroupAttribute($groupAttribute){
  54. $this->groupAttribute = $groupAttribute;
  55. }
  56. public function getMachineList(){
  57. return $this->machineList;
  58. }
  59. public function setMachineList($machineList){
  60. $this->machineList = $machineList;
  61. }
  62. public function getCreateTime(){
  63. return $this->createTime;
  64. }
  65. public function setCreateTime($createTime){
  66. $this->createTime = $createTime;
  67. }
  68. public function getLastModifyTime(){
  69. return $this->lastModifyTime;
  70. }
  71. public function setLastModifyTime($lastModifyTime){
  72. $this->lastModifyTime = $lastModifyTime;
  73. }
  74. public function toArray(){
  75. $format_array = array();
  76. if($this->groupName!==null)
  77. $format_array['groupName'] = $this->groupName;
  78. if($this->groupType!==null)
  79. $format_array['groupType'] = $this->groupType;
  80. if($this->groupAttribute!==null)
  81. $format_array['groupAttribute'] = $this->groupAttribute->toArray();
  82. if($this->machineList!==null){
  83. $mlArr = array();
  84. foreach($this->machineList as $value){
  85. $mlArr[] = $value->toArray();
  86. }
  87. $format_array['machineList'] = $mlArr;
  88. }
  89. if($this->createTime!==null)
  90. $format_array['createTime'] = $this->createTime;
  91. if($this->lastModifyTime!==null)
  92. $format_array['lastModifyTime'] = $this->lastModifyTime;
  93. return $format_array;
  94. }
  95. public function setFromArray($resp){
  96. $groupAttribute = null;
  97. if(isset($resp['groupAttribute'])){
  98. $groupAttributeArr = $resp['groupAttribute'];
  99. $groupAttribute = new Aliyun_Log_Models_MachineGroup_GroupAttribute();
  100. if(isset($groupAttributeArr['externalName']))
  101. $groupAttribute->externalName = $groupAttributeArr['externalName'];
  102. if(isset($groupAttributeArr['groupTopic']))
  103. $groupAttribute->groupTopic = $groupAttributeArr['groupTopic'];
  104. }
  105. $groupName = ($resp['groupName']!==null)?$resp['groupName']:null;
  106. $groupType = ($resp['groupType']!==null)?$resp['groupType']:null;
  107. $machineList = array();
  108. if(isset($resp['machineList']) && is_array($resp['machineList']) && count($resp['machineList'])>0){
  109. foreach($resp['machineList'] as $value){
  110. $machine = new Aliyun_Log_Models_Machine();
  111. $machine->setFromArray($value);
  112. $machineList[] = $machine;
  113. }
  114. }
  115. $createTime = ($resp['createTime']!==null)?$resp['createTime']:null;
  116. $lastModifyTime = ($resp['lastModifyTime']!==null)?$resp['lastModifyTime']:null;
  117. $this->setGroupName($groupName);
  118. $this->setGroupType($groupType);
  119. $this->setGroupAttribute($groupAttribute);
  120. $this->setMachineList($machineList);
  121. $this->setCreateTime($createTime);
  122. $this->setLastModifyTime($lastModifyTime);
  123. }
  124. }