/libraries/fabrik/vendor/twilio/sdk/src/Twilio/Rest/Serverless/V1/Service/Environment/LogInstance.php

https://github.com/trob/fabrik · PHP · 134 lines · 61 code · 13 blank · 60 comment · 3 complexity · 78cb0188886713e6d041ea33149f5ea2 MD5 · raw file

  1. <?php
  2. /**
  3. * This code was generated by
  4. * \ / _ _ _| _ _
  5. * | (_)\/(_)(_|\/| |(/_ v1.0.0
  6. * / /
  7. */
  8. namespace Twilio\Rest\Serverless\V1\Service\Environment;
  9. use Twilio\Deserialize;
  10. use Twilio\Exceptions\TwilioException;
  11. use Twilio\InstanceResource;
  12. use Twilio\Values;
  13. use Twilio\Version;
  14. /**
  15. * PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
  16. *
  17. * @property string $sid
  18. * @property string $accountSid
  19. * @property string $serviceSid
  20. * @property string $environmentSid
  21. * @property string $deploymentSid
  22. * @property string $functionSid
  23. * @property string $requestSid
  24. * @property string $level
  25. * @property string $message
  26. * @property \DateTime $dateCreated
  27. * @property string $url
  28. */
  29. class LogInstance extends InstanceResource {
  30. /**
  31. * Initialize the LogInstance
  32. *
  33. * @param \Twilio\Version $version Version that contains the resource
  34. * @param mixed[] $payload The response payload
  35. * @param string $serviceSid The SID of the Service that the Log resource is
  36. * associated with
  37. * @param string $environmentSid The SID of the environment in which the log
  38. * occurred
  39. * @param string $sid The SID that identifies the Log resource to fetch
  40. * @return \Twilio\Rest\Serverless\V1\Service\Environment\LogInstance
  41. */
  42. public function __construct(Version $version, array $payload, $serviceSid, $environmentSid, $sid = null) {
  43. parent::__construct($version);
  44. // Marshaled Properties
  45. $this->properties = array(
  46. 'sid' => Values::array_get($payload, 'sid'),
  47. 'accountSid' => Values::array_get($payload, 'account_sid'),
  48. 'serviceSid' => Values::array_get($payload, 'service_sid'),
  49. 'environmentSid' => Values::array_get($payload, 'environment_sid'),
  50. 'deploymentSid' => Values::array_get($payload, 'deployment_sid'),
  51. 'functionSid' => Values::array_get($payload, 'function_sid'),
  52. 'requestSid' => Values::array_get($payload, 'request_sid'),
  53. 'level' => Values::array_get($payload, 'level'),
  54. 'message' => Values::array_get($payload, 'message'),
  55. 'dateCreated' => Deserialize::dateTime(Values::array_get($payload, 'date_created')),
  56. 'url' => Values::array_get($payload, 'url'),
  57. );
  58. $this->solution = array(
  59. 'serviceSid' => $serviceSid,
  60. 'environmentSid' => $environmentSid,
  61. 'sid' => $sid ?: $this->properties['sid'],
  62. );
  63. }
  64. /**
  65. * Generate an instance context for the instance, the context is capable of
  66. * performing various actions. All instance actions are proxied to the context
  67. *
  68. * @return \Twilio\Rest\Serverless\V1\Service\Environment\LogContext Context
  69. * for this
  70. * LogInstance
  71. */
  72. protected function proxy() {
  73. if (!$this->context) {
  74. $this->context = new LogContext(
  75. $this->version,
  76. $this->solution['serviceSid'],
  77. $this->solution['environmentSid'],
  78. $this->solution['sid']
  79. );
  80. }
  81. return $this->context;
  82. }
  83. /**
  84. * Fetch a LogInstance
  85. *
  86. * @return LogInstance Fetched LogInstance
  87. * @throws TwilioException When an HTTP error occurs.
  88. */
  89. public function fetch() {
  90. return $this->proxy()->fetch();
  91. }
  92. /**
  93. * Magic getter to access properties
  94. *
  95. * @param string $name Property to access
  96. * @return mixed The requested property
  97. * @throws TwilioException For unknown properties
  98. */
  99. public function __get($name) {
  100. if (\array_key_exists($name, $this->properties)) {
  101. return $this->properties[$name];
  102. }
  103. if (\property_exists($this, '_' . $name)) {
  104. $method = 'get' . \ucfirst($name);
  105. return $this->$method();
  106. }
  107. throw new TwilioException('Unknown property: ' . $name);
  108. }
  109. /**
  110. * Provide a friendly representation
  111. *
  112. * @return string Machine friendly representation
  113. */
  114. public function __toString() {
  115. $context = array();
  116. foreach ($this->solution as $key => $value) {
  117. $context[] = "$key=$value";
  118. }
  119. return '[Twilio.Serverless.V1.LogInstance ' . \implode(' ', $context) . ']';
  120. }
  121. }