Policy.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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\BigtableAdmin;
  18. class Policy extends \Google\Collection
  19. {
  20. protected $collection_key = 'bindings';
  21. protected $auditConfigsType = AuditConfig::class;
  22. protected $auditConfigsDataType = 'array';
  23. protected $bindingsType = Binding::class;
  24. protected $bindingsDataType = 'array';
  25. /**
  26. * `etag` is used for optimistic concurrency control as a way to help prevent
  27. * simultaneous updates of a policy from overwriting each other. It is
  28. * strongly suggested that systems make use of the `etag` in the read-modify-
  29. * write cycle to perform policy updates in order to avoid race conditions: An
  30. * `etag` is returned in the response to `getIamPolicy`, and systems are
  31. * expected to put that etag in the request to `setIamPolicy` to ensure that
  32. * their change will be applied to the same version of the policy.
  33. * **Important:** If you use IAM Conditions, you must include the `etag` field
  34. * whenever you call `setIamPolicy`. If you omit this field, then IAM allows
  35. * you to overwrite a version `3` policy with a version `1` policy, and all of
  36. * the conditions in the version `3` policy are lost.
  37. *
  38. * @var string
  39. */
  40. public $etag;
  41. /**
  42. * Specifies the format of the policy. Valid values are `0`, `1`, and `3`.
  43. * Requests that specify an invalid value are rejected. Any operation that
  44. * affects conditional role bindings must specify version `3`. This
  45. * requirement applies to the following operations: * Getting a policy that
  46. * includes a conditional role binding * Adding a conditional role binding to
  47. * a policy * Changing a conditional role binding in a policy * Removing any
  48. * role binding, with or without a condition, from a policy that includes
  49. * conditions **Important:** If you use IAM Conditions, you must include the
  50. * `etag` field whenever you call `setIamPolicy`. If you omit this field, then
  51. * IAM allows you to overwrite a version `3` policy with a version `1` policy,
  52. * and all of the conditions in the version `3` policy are lost. If a policy
  53. * does not include any conditions, operations on that policy may specify any
  54. * valid version or leave the field unset. To learn which resources support
  55. * conditions in their IAM policies, see the [IAM
  56. * documentation](https://cloud.google.com/iam/help/conditions/resource-
  57. * policies).
  58. *
  59. * @var int
  60. */
  61. public $version;
  62. /**
  63. * Specifies cloud audit logging configuration for this policy.
  64. *
  65. * @param AuditConfig[] $auditConfigs
  66. */
  67. public function setAuditConfigs($auditConfigs)
  68. {
  69. $this->auditConfigs = $auditConfigs;
  70. }
  71. /**
  72. * @return AuditConfig[]
  73. */
  74. public function getAuditConfigs()
  75. {
  76. return $this->auditConfigs;
  77. }
  78. /**
  79. * Associates a list of `members`, or principals, with a `role`. Optionally,
  80. * may specify a `condition` that determines how and when the `bindings` are
  81. * applied. Each of the `bindings` must contain at least one principal. The
  82. * `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of
  83. * these principals can be Google groups. Each occurrence of a principal
  84. * counts towards these limits. For example, if the `bindings` grant 50
  85. * different roles to `user:alice@example.com`, and not to any other
  86. * principal, then you can add another 1,450 principals to the `bindings` in
  87. * the `Policy`.
  88. *
  89. * @param Binding[] $bindings
  90. */
  91. public function setBindings($bindings)
  92. {
  93. $this->bindings = $bindings;
  94. }
  95. /**
  96. * @return Binding[]
  97. */
  98. public function getBindings()
  99. {
  100. return $this->bindings;
  101. }
  102. /**
  103. * `etag` is used for optimistic concurrency control as a way to help prevent
  104. * simultaneous updates of a policy from overwriting each other. It is
  105. * strongly suggested that systems make use of the `etag` in the read-modify-
  106. * write cycle to perform policy updates in order to avoid race conditions: An
  107. * `etag` is returned in the response to `getIamPolicy`, and systems are
  108. * expected to put that etag in the request to `setIamPolicy` to ensure that
  109. * their change will be applied to the same version of the policy.
  110. * **Important:** If you use IAM Conditions, you must include the `etag` field
  111. * whenever you call `setIamPolicy`. If you omit this field, then IAM allows
  112. * you to overwrite a version `3` policy with a version `1` policy, and all of
  113. * the conditions in the version `3` policy are lost.
  114. *
  115. * @param string $etag
  116. */
  117. public function setEtag($etag)
  118. {
  119. $this->etag = $etag;
  120. }
  121. /**
  122. * @return string
  123. */
  124. public function getEtag()
  125. {
  126. return $this->etag;
  127. }
  128. /**
  129. * Specifies the format of the policy. Valid values are `0`, `1`, and `3`.
  130. * Requests that specify an invalid value are rejected. Any operation that
  131. * affects conditional role bindings must specify version `3`. This
  132. * requirement applies to the following operations: * Getting a policy that
  133. * includes a conditional role binding * Adding a conditional role binding to
  134. * a policy * Changing a conditional role binding in a policy * Removing any
  135. * role binding, with or without a condition, from a policy that includes
  136. * conditions **Important:** If you use IAM Conditions, you must include the
  137. * `etag` field whenever you call `setIamPolicy`. If you omit this field, then
  138. * IAM allows you to overwrite a version `3` policy with a version `1` policy,
  139. * and all of the conditions in the version `3` policy are lost. If a policy
  140. * does not include any conditions, operations on that policy may specify any
  141. * valid version or leave the field unset. To learn which resources support
  142. * conditions in their IAM policies, see the [IAM
  143. * documentation](https://cloud.google.com/iam/help/conditions/resource-
  144. * policies).
  145. *
  146. * @param int $version
  147. */
  148. public function setVersion($version)
  149. {
  150. $this->version = $version;
  151. }
  152. /**
  153. * @return int
  154. */
  155. public function getVersion()
  156. {
  157. return $this->version;
  158. }
  159. }
  160. // Adding a class alias for backwards compatibility with the previous class name.
  161. class_alias(Policy::class, 'Google_Service_BigtableAdmin_Policy');