BackendServiceLogConfig.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. /*
  3. * Copyright 2014 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  6. * use this file except in compliance with the License. You may obtain a copy of
  7. * the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. * License for the specific language governing permissions and limitations under
  15. * the License.
  16. */
  17. namespace Google\Service\Compute;
  18. class BackendServiceLogConfig extends \Google\Collection
  19. {
  20. /**
  21. * A subset of optional fields.
  22. */
  23. public const OPTIONAL_MODE_CUSTOM = 'CUSTOM';
  24. /**
  25. * None optional fields.
  26. */
  27. public const OPTIONAL_MODE_EXCLUDE_ALL_OPTIONAL = 'EXCLUDE_ALL_OPTIONAL';
  28. /**
  29. * All optional fields.
  30. */
  31. public const OPTIONAL_MODE_INCLUDE_ALL_OPTIONAL = 'INCLUDE_ALL_OPTIONAL';
  32. protected $collection_key = 'optionalFields';
  33. /**
  34. * Denotes whether to enable logging for the load balancer traffic served by
  35. * this backend service. The default value is false.
  36. *
  37. * @var bool
  38. */
  39. public $enable;
  40. /**
  41. * This field can only be specified if logging is enabled for this backend
  42. * service and "logConfig.optionalMode" was set to CUSTOM. Contains a list of
  43. * optional fields you want to include in the logs. For example:
  44. * serverInstance, serverGkeDetails.cluster, serverGkeDetails.pod.podNamespace
  45. *
  46. * @var string[]
  47. */
  48. public $optionalFields;
  49. /**
  50. * This field can only be specified if logging is enabled for this backend
  51. * service. Configures whether all, none or a subset of optional fields should
  52. * be added to the reported logs. One of [INCLUDE_ALL_OPTIONAL,
  53. * EXCLUDE_ALL_OPTIONAL, CUSTOM]. Default is EXCLUDE_ALL_OPTIONAL.
  54. *
  55. * @var string
  56. */
  57. public $optionalMode;
  58. /**
  59. * This field can only be specified if logging is enabled for this backend
  60. * service. The value of the field must be in [0, 1]. This configures the
  61. * sampling rate of requests to the load balancer where 1.0 means all logged
  62. * requests are reported and 0.0 means no logged requests are reported. The
  63. * default value is 1.0.
  64. *
  65. * @var float
  66. */
  67. public $sampleRate;
  68. /**
  69. * Denotes whether to enable logging for the load balancer traffic served by
  70. * this backend service. The default value is false.
  71. *
  72. * @param bool $enable
  73. */
  74. public function setEnable($enable)
  75. {
  76. $this->enable = $enable;
  77. }
  78. /**
  79. * @return bool
  80. */
  81. public function getEnable()
  82. {
  83. return $this->enable;
  84. }
  85. /**
  86. * This field can only be specified if logging is enabled for this backend
  87. * service and "logConfig.optionalMode" was set to CUSTOM. Contains a list of
  88. * optional fields you want to include in the logs. For example:
  89. * serverInstance, serverGkeDetails.cluster, serverGkeDetails.pod.podNamespace
  90. *
  91. * @param string[] $optionalFields
  92. */
  93. public function setOptionalFields($optionalFields)
  94. {
  95. $this->optionalFields = $optionalFields;
  96. }
  97. /**
  98. * @return string[]
  99. */
  100. public function getOptionalFields()
  101. {
  102. return $this->optionalFields;
  103. }
  104. /**
  105. * This field can only be specified if logging is enabled for this backend
  106. * service. Configures whether all, none or a subset of optional fields should
  107. * be added to the reported logs. One of [INCLUDE_ALL_OPTIONAL,
  108. * EXCLUDE_ALL_OPTIONAL, CUSTOM]. Default is EXCLUDE_ALL_OPTIONAL.
  109. *
  110. * Accepted values: CUSTOM, EXCLUDE_ALL_OPTIONAL, INCLUDE_ALL_OPTIONAL
  111. *
  112. * @param self::OPTIONAL_MODE_* $optionalMode
  113. */
  114. public function setOptionalMode($optionalMode)
  115. {
  116. $this->optionalMode = $optionalMode;
  117. }
  118. /**
  119. * @return self::OPTIONAL_MODE_*
  120. */
  121. public function getOptionalMode()
  122. {
  123. return $this->optionalMode;
  124. }
  125. /**
  126. * This field can only be specified if logging is enabled for this backend
  127. * service. The value of the field must be in [0, 1]. This configures the
  128. * sampling rate of requests to the load balancer where 1.0 means all logged
  129. * requests are reported and 0.0 means no logged requests are reported. The
  130. * default value is 1.0.
  131. *
  132. * @param float $sampleRate
  133. */
  134. public function setSampleRate($sampleRate)
  135. {
  136. $this->sampleRate = $sampleRate;
  137. }
  138. /**
  139. * @return float
  140. */
  141. public function getSampleRate()
  142. {
  143. return $this->sampleRate;
  144. }
  145. }
  146. // Adding a class alias for backwards compatibility with the previous class name.
  147. class_alias(BackendServiceLogConfig::class, 'Google_Service_Compute_BackendServiceLogConfig');