PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/google/apiclient-services/src/Iam/Resource/ProjectsRoles.php

https://gitlab.com/Japang-Jawara/jawara-penilaian
PHP | 256 lines | 46 code | 4 blank | 206 comment | 0 complexity | 4f046a17b0db4a3ed071b95ae82c6e74 MD5 | raw file
  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\Iam\Resource;
  18. use Google\Service\Iam\CreateRoleRequest;
  19. use Google\Service\Iam\ListRolesResponse;
  20. use Google\Service\Iam\Role;
  21. use Google\Service\Iam\UndeleteRoleRequest;
  22. /**
  23. * The "roles" collection of methods.
  24. * Typical usage is:
  25. * <code>
  26. * $iamService = new Google\Service\Iam(...);
  27. * $roles = $iamService->roles;
  28. * </code>
  29. */
  30. class ProjectsRoles extends \Google\Service\Resource
  31. {
  32. /**
  33. * Creates a new custom Role. (roles.create)
  34. *
  35. * @param string $parent The `parent` parameter's value depends on the target
  36. * resource for the request, namely
  37. * [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
  38. * or [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizat
  39. * ions.roles). Each resource type's `parent` value format is described below: *
  40. * [`projects.roles.create()`](https://cloud.google.com/iam/reference/rest/v1/pr
  41. * ojects.roles/create): `projects/{PROJECT_ID}`. This method creates project-
  42. * level [custom roles](https://cloud.google.com/iam/docs/understanding-custom-
  43. * roles). Example request URL:
  44. * `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [`organizations
  45. * .roles.create()`](https://cloud.google.com/iam/reference/rest/v1/organization
  46. * s.roles/create): `organizations/{ORGANIZATION_ID}`. This method creates
  47. * organization-level [custom roles](https://cloud.google.com/iam/docs
  48. * /understanding-custom-roles). Example request URL:
  49. * `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note:
  50. * Wildcard (*) values are invalid; you must specify a complete project ID or
  51. * organization ID.
  52. * @param CreateRoleRequest $postBody
  53. * @param array $optParams Optional parameters.
  54. * @return Role
  55. */
  56. public function create($parent, CreateRoleRequest $postBody, $optParams = [])
  57. {
  58. $params = ['parent' => $parent, 'postBody' => $postBody];
  59. $params = array_merge($params, $optParams);
  60. return $this->call('create', [$params], Role::class);
  61. }
  62. /**
  63. * Deletes a custom Role. When you delete a custom role, the following changes
  64. * occur immediately: * You cannot bind a principal to the custom role in an IAM
  65. * Policy. * Existing bindings to the custom role are not changed, but they have
  66. * no effect. * By default, the response from ListRoles does not include the
  67. * custom role. You have 7 days to undelete the custom role. After 7 days, the
  68. * following changes occur: * The custom role is permanently deleted and cannot
  69. * be recovered. * If an IAM policy contains a binding to the custom role, the
  70. * binding is permanently removed. (roles.delete)
  71. *
  72. * @param string $name The `name` parameter's value depends on the target
  73. * resource for the request, namely
  74. * [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
  75. * or [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizat
  76. * ions.roles). Each resource type's `name` value format is described below: * [
  77. * `projects.roles.delete()`](https://cloud.google.com/iam/reference/rest/v1/pro
  78. * jects.roles/delete): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This
  79. * method deletes only [custom roles](https://cloud.google.com/iam/docs
  80. * /understanding-custom-roles) that have been created at the project level.
  81. * Example request URL:
  82. * `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`
  83. * * [`organizations.roles.delete()`](https://cloud.google.com/iam/reference/res
  84. * t/v1/organizations.roles/delete):
  85. * `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method deletes
  86. * only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-
  87. * roles) that have been created at the organization level. Example request URL:
  88. * `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_
  89. * ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete
  90. * project ID or organization ID.
  91. * @param array $optParams Optional parameters.
  92. *
  93. * @opt_param string etag Used to perform a consistent read-modify-write.
  94. * @return Role
  95. */
  96. public function delete($name, $optParams = [])
  97. {
  98. $params = ['name' => $name];
  99. $params = array_merge($params, $optParams);
  100. return $this->call('delete', [$params], Role::class);
  101. }
  102. /**
  103. * Gets the definition of a Role. (roles.get)
  104. *
  105. * @param string $name The `name` parameter's value depends on the target
  106. * resource for the request, namely
  107. * [`roles`](https://cloud.google.com/iam/reference/rest/v1/roles),
  108. * [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles),
  109. * or [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizat
  110. * ions.roles). Each resource type's `name` value format is described below: *
  111. * [`roles.get()`](https://cloud.google.com/iam/reference/rest/v1/roles/get):
  112. * `roles/{ROLE_NAME}`. This method returns results from all [predefined
  113. * roles](https://cloud.google.com/iam/docs/understanding-
  114. * roles#predefined_roles) in Cloud IAM. Example request URL:
  115. * `https://iam.googleapis.com/v1/roles/{ROLE_NAME}` * [`projects.roles.get()`](
  116. * https://cloud.google.com/iam/reference/rest/v1/projects.roles/get):
  117. * `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns only
  118. * [custom roles](https://cloud.google.com/iam/docs/understanding-custom-roles)
  119. * that have been created at the project level. Example request URL:
  120. * `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`
  121. * * [`organizations.roles.get()`](https://cloud.google.com/iam/reference/rest/v
  122. * 1/organizations.roles/get):
  123. * `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method returns
  124. * only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-
  125. * roles) that have been created at the organization level. Example request URL:
  126. * `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_
  127. * ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete
  128. * project ID or organization ID.
  129. * @param array $optParams Optional parameters.
  130. * @return Role
  131. */
  132. public function get($name, $optParams = [])
  133. {
  134. $params = ['name' => $name];
  135. $params = array_merge($params, $optParams);
  136. return $this->call('get', [$params], Role::class);
  137. }
  138. /**
  139. * Lists every predefined Role that IAM supports, or every custom role that is
  140. * defined for an organization or project. (roles.listProjectsRoles)
  141. *
  142. * @param string $parent The `parent` parameter's value depends on the target
  143. * resource for the request, namely
  144. * [`roles`](https://cloud.google.com/iam/reference/rest/v1/roles),
  145. * [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles),
  146. * or [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizat
  147. * ions.roles). Each resource type's `parent` value format is described below: *
  148. * [`roles.list()`](https://cloud.google.com/iam/reference/rest/v1/roles/list):
  149. * An empty string. This method doesn't require a resource; it simply returns
  150. * all [predefined roles](https://cloud.google.com/iam/docs/understanding-
  151. * roles#predefined_roles) in Cloud IAM. Example request URL:
  152. * `https://iam.googleapis.com/v1/roles` * [`projects.roles.list()`](https://clo
  153. * ud.google.com/iam/reference/rest/v1/projects.roles/list):
  154. * `projects/{PROJECT_ID}`. This method lists all project-level [custom
  155. * roles](https://cloud.google.com/iam/docs/understanding-custom-roles). Example
  156. * request URL: `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles` * [`
  157. * organizations.roles.list()`](https://cloud.google.com/iam/reference/rest/v1/o
  158. * rganizations.roles/list): `organizations/{ORGANIZATION_ID}`. This method
  159. * lists all organization-level [custom roles](https://cloud.google.com/iam/docs
  160. * /understanding-custom-roles). Example request URL:
  161. * `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles` Note:
  162. * Wildcard (*) values are invalid; you must specify a complete project ID or
  163. * organization ID.
  164. * @param array $optParams Optional parameters.
  165. *
  166. * @opt_param int pageSize Optional limit on the number of roles to include in
  167. * the response. The default is 300, and the maximum is 1,000.
  168. * @opt_param string pageToken Optional pagination token returned in an earlier
  169. * ListRolesResponse.
  170. * @opt_param bool showDeleted Include Roles that have been deleted.
  171. * @opt_param string view Optional view for the returned Role objects. When
  172. * `FULL` is specified, the `includedPermissions` field is returned, which
  173. * includes a list of all permissions in the role. The default value is `BASIC`,
  174. * which does not return the `includedPermissions` field.
  175. * @return ListRolesResponse
  176. */
  177. public function listProjectsRoles($parent, $optParams = [])
  178. {
  179. $params = ['parent' => $parent];
  180. $params = array_merge($params, $optParams);
  181. return $this->call('list', [$params], ListRolesResponse::class);
  182. }
  183. /**
  184. * Updates the definition of a custom Role. (roles.patch)
  185. *
  186. * @param string $name The `name` parameter's value depends on the target
  187. * resource for the request, namely
  188. * [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
  189. * or [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizat
  190. * ions.roles). Each resource type's `name` value format is described below: * [
  191. * `projects.roles.patch()`](https://cloud.google.com/iam/reference/rest/v1/proj
  192. * ects.roles/patch): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This
  193. * method updates only [custom roles](https://cloud.google.com/iam/docs
  194. * /understanding-custom-roles) that have been created at the project level.
  195. * Example request URL:
  196. * `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`
  197. * * [`organizations.roles.patch()`](https://cloud.google.com/iam/reference/rest
  198. * /v1/organizations.roles/patch):
  199. * `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method updates
  200. * only [custom roles](https://cloud.google.com/iam/docs/understanding-custom-
  201. * roles) that have been created at the organization level. Example request URL:
  202. * `https://iam.googleapis.com/v1/organizations/{ORGANIZATION_ID}/roles/{CUSTOM_
  203. * ROLE_ID}` Note: Wildcard (*) values are invalid; you must specify a complete
  204. * project ID or organization ID.
  205. * @param Role $postBody
  206. * @param array $optParams Optional parameters.
  207. *
  208. * @opt_param string updateMask A mask describing which fields in the Role have
  209. * changed.
  210. * @return Role
  211. */
  212. public function patch($name, Role $postBody, $optParams = [])
  213. {
  214. $params = ['name' => $name, 'postBody' => $postBody];
  215. $params = array_merge($params, $optParams);
  216. return $this->call('patch', [$params], Role::class);
  217. }
  218. /**
  219. * Undeletes a custom Role. (roles.undelete)
  220. *
  221. * @param string $name The `name` parameter's value depends on the target
  222. * resource for the request, namely
  223. * [`projects`](https://cloud.google.com/iam/reference/rest/v1/projects.roles)
  224. * or [`organizations`](https://cloud.google.com/iam/reference/rest/v1/organizat
  225. * ions.roles). Each resource type's `name` value format is described below: * [
  226. * `projects.roles.undelete()`](https://cloud.google.com/iam/reference/rest/v1/p
  227. * rojects.roles/undelete): `projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`. This
  228. * method undeletes only [custom roles](https://cloud.google.com/iam/docs
  229. * /understanding-custom-roles) that have been created at the project level.
  230. * Example request URL:
  231. * `https://iam.googleapis.com/v1/projects/{PROJECT_ID}/roles/{CUSTOM_ROLE_ID}`
  232. * * [`organizations.roles.undelete()`](https://cloud.google.com/iam/reference/r
  233. * est/v1/organizations.roles/undelete):
  234. * `organizations/{ORGANIZATION_ID}/roles/{CUSTOM_ROLE_ID}`. This method
  235. * undeletes only [custom roles](https://cloud.google.com/iam/docs
  236. * /understanding-custom-roles) that have been created at the organization
  237. * level. Example request URL: `https://iam.googleapis.com/v1/organizations/{ORG
  238. * ANIZATION_ID}/roles/{CUSTOM_ROLE_ID}` Note: Wildcard (*) values are invalid;
  239. * you must specify a complete project ID or organization ID.
  240. * @param UndeleteRoleRequest $postBody
  241. * @param array $optParams Optional parameters.
  242. * @return Role
  243. */
  244. public function undelete($name, UndeleteRoleRequest $postBody, $optParams = [])
  245. {
  246. $params = ['name' => $name, 'postBody' => $postBody];
  247. $params = array_merge($params, $optParams);
  248. return $this->call('undelete', [$params], Role::class);
  249. }
  250. }
  251. // Adding a class alias for backwards compatibility with the previous class name.
  252. class_alias(ProjectsRoles::class, 'Google_Service_Iam_Resource_ProjectsRoles');