MicrosoftAzureStorageCommonModelsMetrics

Holds elements of queue properties metrics field.

Defined (1)

The class is defined in the following location(s).

/lib/Azure/MicrosoftAzureStorage/Common/Models/Metrics.php  
  1. class Metrics 
  2. /** 
  3. * The version of Storage Analytics to configure 
  4. *  
  5. * @var string 
  6. */ 
  7. private $_version; 
  8.  
  9. /** 
  10. * Indicates whether metrics is enabled for the storage service 
  11. *  
  12. * @var bool 
  13. */ 
  14. private $_enabled; 
  15.  
  16. /** 
  17. * Indicates whether a retention policy is enabled for the storage service 
  18. *  
  19. * @var bool 
  20. */ 
  21. private $_includeAPIs; 
  22.  
  23. /** 
  24. * @var MicrosoftAzure\Storage\Common\Models\RetentionPolicy 
  25. */ 
  26. private $_retentionPolicy; 
  27.  
  28. /** 
  29. * Creates object from $parsedResponse. 
  30. *  
  31. * @param array $parsedResponse XML response parsed into array. 
  32. *  
  33. * @return MicrosoftAzure\Storage\Common\Models\Metrics 
  34. */ 
  35. public static function create($parsedResponse) 
  36. $result = new Metrics(); 
  37. $result->setVersion($parsedResponse['Version']); 
  38. $result->setEnabled(Utilities::toBoolean($parsedResponse['Enabled'])); 
  39. if ($result->getEnabled()) { 
  40. $result->setIncludeAPIs( 
  41. Utilities::toBoolean($parsedResponse['IncludeAPIs']) 
  42. ); 
  43. $result->setRetentionPolicy( 
  44. RetentionPolicy::create($parsedResponse['RetentionPolicy']) 
  45. ); 
  46.  
  47. return $result; 
  48.  
  49. /** 
  50. * Gets retention policy 
  51. *  
  52. * @return MicrosoftAzure\Storage\Common\Models\RetentionPolicy 
  53. *  
  54. */ 
  55. public function getRetentionPolicy() 
  56. return $this->_retentionPolicy; 
  57.  
  58. /** 
  59. * Sets retention policy 
  60. *  
  61. * @param RetentionPolicy $policy object to use 
  62. *  
  63. * @return none. 
  64. */ 
  65. public function setRetentionPolicy($policy) 
  66. $this->_retentionPolicy = $policy; 
  67.  
  68. /** 
  69. * Gets include APIs. 
  70. *  
  71. * @return bool.  
  72. */ 
  73. public function getIncludeAPIs() 
  74. return $this->_includeAPIs; 
  75.  
  76. /** 
  77. * Sets include APIs. 
  78. *  
  79. * @param $bool $includeAPIs value to use. 
  80. *  
  81. * @return none.  
  82. */ 
  83. public function setIncludeAPIs($includeAPIs) 
  84. $this->_includeAPIs = $includeAPIs; 
  85.  
  86. /** 
  87. * Gets enabled. 
  88. *  
  89. * @return bool.  
  90. */ 
  91. public function getEnabled() 
  92. return $this->_enabled; 
  93.  
  94. /** 
  95. * Sets enabled. 
  96. *  
  97. * @param bool $enabled value to use. 
  98. *  
  99. * @return none.  
  100. */ 
  101. public function setEnabled($enabled) 
  102. $this->_enabled = $enabled; 
  103.  
  104. /** 
  105. * Gets version 
  106. *  
  107. * @return string. 
  108. */ 
  109. public function getVersion() 
  110. return $this->_version; 
  111.  
  112. /** 
  113. * Sets version 
  114. *  
  115. * @param string $version new value. 
  116. *  
  117. * @return none. 
  118. */ 
  119. public function setVersion($version) 
  120. $this->_version = $version; 
  121.  
  122. /** 
  123. * Converts this object to array with XML tags 
  124. *  
  125. * @return array.  
  126. */ 
  127. public function toArray() 
  128. $array = array( 
  129. 'Version' => $this->_version,  
  130. 'Enabled' => Utilities::booleanToString($this->_enabled) 
  131. ); 
  132. if ($this->_enabled) { 
  133. $array['IncludeAPIs'] = Utilities::booleanToString($this->_includeAPIs); 
  134. $array['RetentionPolicy'] = !empty($this->_retentionPolicy) 
  135. ? $this->_retentionPolicy->toArray() 
  136. : null; 
  137.  
  138. return $array;