PageRenderTime 25ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/google/apiclient-services/src/Spanner/Resource/ProjectsInstancesDatabases.php

https://gitlab.com/Japang-Jawara/jawara-penilaian
PHP | 267 lines | 86 code | 4 blank | 177 comment | 0 complexity | 3023af85c094bdefca5cb0ec45cc5d99 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\Spanner\Resource;
  18. use Google\Service\Spanner\CreateDatabaseRequest;
  19. use Google\Service\Spanner\Database;
  20. use Google\Service\Spanner\GetDatabaseDdlResponse;
  21. use Google\Service\Spanner\GetIamPolicyRequest;
  22. use Google\Service\Spanner\ListDatabasesResponse;
  23. use Google\Service\Spanner\Operation;
  24. use Google\Service\Spanner\Policy;
  25. use Google\Service\Spanner\RestoreDatabaseRequest;
  26. use Google\Service\Spanner\Scan;
  27. use Google\Service\Spanner\SetIamPolicyRequest;
  28. use Google\Service\Spanner\SpannerEmpty;
  29. use Google\Service\Spanner\TestIamPermissionsRequest;
  30. use Google\Service\Spanner\TestIamPermissionsResponse;
  31. use Google\Service\Spanner\UpdateDatabaseDdlRequest;
  32. /**
  33. * The "databases" collection of methods.
  34. * Typical usage is:
  35. * <code>
  36. * $spannerService = new Google\Service\Spanner(...);
  37. * $databases = $spannerService->databases;
  38. * </code>
  39. */
  40. class ProjectsInstancesDatabases extends \Google\Service\Resource
  41. {
  42. /**
  43. * Creates a new Cloud Spanner database and starts to prepare it for serving.
  44. * The returned long-running operation will have a name of the format
  45. * `/operations/` and can be used to track preparation of the database. The
  46. * metadata field type is CreateDatabaseMetadata. The response field type is
  47. * Database, if successful. (databases.create)
  48. *
  49. * @param string $parent Required. The name of the instance that will serve the
  50. * new database. Values are of the form `projects//instances/`.
  51. * @param CreateDatabaseRequest $postBody
  52. * @param array $optParams Optional parameters.
  53. * @return Operation
  54. */
  55. public function create($parent, CreateDatabaseRequest $postBody, $optParams = [])
  56. {
  57. $params = ['parent' => $parent, 'postBody' => $postBody];
  58. $params = array_merge($params, $optParams);
  59. return $this->call('create', [$params], Operation::class);
  60. }
  61. /**
  62. * Drops (aka deletes) a Cloud Spanner database. Completed backups for the
  63. * database will be retained according to their `expire_time`. Note: Cloud
  64. * Spanner might continue to accept requests for a few seconds after the
  65. * database has been deleted. (databases.dropDatabase)
  66. *
  67. * @param string $database Required. The database to be dropped.
  68. * @param array $optParams Optional parameters.
  69. * @return SpannerEmpty
  70. */
  71. public function dropDatabase($database, $optParams = [])
  72. {
  73. $params = ['database' => $database];
  74. $params = array_merge($params, $optParams);
  75. return $this->call('dropDatabase', [$params], SpannerEmpty::class);
  76. }
  77. /**
  78. * Gets the state of a Cloud Spanner database. (databases.get)
  79. *
  80. * @param string $name Required. The name of the requested database. Values are
  81. * of the form `projects//instances//databases/`.
  82. * @param array $optParams Optional parameters.
  83. * @return Database
  84. */
  85. public function get($name, $optParams = [])
  86. {
  87. $params = ['name' => $name];
  88. $params = array_merge($params, $optParams);
  89. return $this->call('get', [$params], Database::class);
  90. }
  91. /**
  92. * Returns the schema of a Cloud Spanner database as a list of formatted DDL
  93. * statements. This method does not show pending schema updates, those may be
  94. * queried using the Operations API. (databases.getDdl)
  95. *
  96. * @param string $database Required. The database whose schema we wish to get.
  97. * Values are of the form `projects//instances//databases/`
  98. * @param array $optParams Optional parameters.
  99. * @return GetDatabaseDdlResponse
  100. */
  101. public function getDdl($database, $optParams = [])
  102. {
  103. $params = ['database' => $database];
  104. $params = array_merge($params, $optParams);
  105. return $this->call('getDdl', [$params], GetDatabaseDdlResponse::class);
  106. }
  107. /**
  108. * Gets the access control policy for a database or backup resource. Returns an
  109. * empty policy if a database or backup exists but does not have a policy set.
  110. * Authorization requires `spanner.databases.getIamPolicy` permission on
  111. * resource. For backups, authorization requires `spanner.backups.getIamPolicy`
  112. * permission on resource. (databases.getIamPolicy)
  113. *
  114. * @param string $resource REQUIRED: The Cloud Spanner resource for which the
  115. * policy is being retrieved. The format is `projects//instances/` for instance
  116. * resources and `projects//instances//databases/` for database resources.
  117. * @param GetIamPolicyRequest $postBody
  118. * @param array $optParams Optional parameters.
  119. * @return Policy
  120. */
  121. public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
  122. {
  123. $params = ['resource' => $resource, 'postBody' => $postBody];
  124. $params = array_merge($params, $optParams);
  125. return $this->call('getIamPolicy', [$params], Policy::class);
  126. }
  127. /**
  128. * Request a specific scan with Database-specific data for Cloud Key Visualizer.
  129. * (databases.getScans)
  130. *
  131. * @param string $name Required. The unique name of the scan containing the
  132. * requested information, specific to the Database service implementing this
  133. * interface.
  134. * @param array $optParams Optional parameters.
  135. *
  136. * @opt_param string endTime The upper bound for the time range to retrieve Scan
  137. * data for.
  138. * @opt_param string startTime These fields restrict the Database-specific
  139. * information returned in the `Scan.data` field. If a `View` is provided that
  140. * does not include the `Scan.data` field, these are ignored. This range of time
  141. * must be entirely contained within the defined time range of the targeted
  142. * scan. The lower bound for the time range to retrieve Scan data for.
  143. * @opt_param string view Specifies which parts of the Scan should be returned
  144. * in the response. Note, if left unspecified, the FULL view is assumed.
  145. * @return Scan
  146. */
  147. public function getScans($name, $optParams = [])
  148. {
  149. $params = ['name' => $name];
  150. $params = array_merge($params, $optParams);
  151. return $this->call('getScans', [$params], Scan::class);
  152. }
  153. /**
  154. * Lists Cloud Spanner databases. (databases.listProjectsInstancesDatabases)
  155. *
  156. * @param string $parent Required. The instance whose databases should be
  157. * listed. Values are of the form `projects//instances/`.
  158. * @param array $optParams Optional parameters.
  159. *
  160. * @opt_param int pageSize Number of databases to be returned in the response.
  161. * If 0 or less, defaults to the server's maximum allowed page size.
  162. * @opt_param string pageToken If non-empty, `page_token` should contain a
  163. * next_page_token from a previous ListDatabasesResponse.
  164. * @return ListDatabasesResponse
  165. */
  166. public function listProjectsInstancesDatabases($parent, $optParams = [])
  167. {
  168. $params = ['parent' => $parent];
  169. $params = array_merge($params, $optParams);
  170. return $this->call('list', [$params], ListDatabasesResponse::class);
  171. }
  172. /**
  173. * Create a new database by restoring from a completed backup. The new database
  174. * must be in the same project and in an instance with the same instance
  175. * configuration as the instance containing the backup. The returned database
  176. * long-running operation has a name of the format
  177. * `projects//instances//databases//operations/`, and can be used to track the
  178. * progress of the operation, and to cancel it. The metadata field type is
  179. * RestoreDatabaseMetadata. The response type is Database, if successful.
  180. * Cancelling the returned operation will stop the restore and delete the
  181. * database. There can be only one database being restored into an instance at a
  182. * time. Once the restore operation completes, a new restore operation can be
  183. * initiated, without waiting for the optimize operation associated with the
  184. * first restore to complete. (databases.restore)
  185. *
  186. * @param string $parent Required. The name of the instance in which to create
  187. * the restored database. This instance must be in the same project and have the
  188. * same instance configuration as the instance containing the source backup.
  189. * Values are of the form `projects//instances/`.
  190. * @param RestoreDatabaseRequest $postBody
  191. * @param array $optParams Optional parameters.
  192. * @return Operation
  193. */
  194. public function restore($parent, RestoreDatabaseRequest $postBody, $optParams = [])
  195. {
  196. $params = ['parent' => $parent, 'postBody' => $postBody];
  197. $params = array_merge($params, $optParams);
  198. return $this->call('restore', [$params], Operation::class);
  199. }
  200. /**
  201. * Sets the access control policy on a database or backup resource. Replaces any
  202. * existing policy. Authorization requires `spanner.databases.setIamPolicy`
  203. * permission on resource. For backups, authorization requires
  204. * `spanner.backups.setIamPolicy` permission on resource.
  205. * (databases.setIamPolicy)
  206. *
  207. * @param string $resource REQUIRED: The Cloud Spanner resource for which the
  208. * policy is being set. The format is `projects//instances/` for instance
  209. * resources and `projects//instances//databases/` for databases resources.
  210. * @param SetIamPolicyRequest $postBody
  211. * @param array $optParams Optional parameters.
  212. * @return Policy
  213. */
  214. public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
  215. {
  216. $params = ['resource' => $resource, 'postBody' => $postBody];
  217. $params = array_merge($params, $optParams);
  218. return $this->call('setIamPolicy', [$params], Policy::class);
  219. }
  220. /**
  221. * Returns permissions that the caller has on the specified database or backup
  222. * resource. Attempting this RPC on a non-existent Cloud Spanner database will
  223. * result in a NOT_FOUND error if the user has `spanner.databases.list`
  224. * permission on the containing Cloud Spanner instance. Otherwise returns an
  225. * empty set of permissions. Calling this method on a backup that does not exist
  226. * will result in a NOT_FOUND error if the user has `spanner.backups.list`
  227. * permission on the containing instance. (databases.testIamPermissions)
  228. *
  229. * @param string $resource REQUIRED: The Cloud Spanner resource for which
  230. * permissions are being tested. The format is `projects//instances/` for
  231. * instance resources and `projects//instances//databases/` for database
  232. * resources.
  233. * @param TestIamPermissionsRequest $postBody
  234. * @param array $optParams Optional parameters.
  235. * @return TestIamPermissionsResponse
  236. */
  237. public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
  238. {
  239. $params = ['resource' => $resource, 'postBody' => $postBody];
  240. $params = array_merge($params, $optParams);
  241. return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
  242. }
  243. /**
  244. * Updates the schema of a Cloud Spanner database by creating/altering/dropping
  245. * tables, columns, indexes, etc. The returned long-running operation will have
  246. * a name of the format `/operations/` and can be used to track execution of the
  247. * schema change(s). The metadata field type is UpdateDatabaseDdlMetadata. The
  248. * operation has no response. (databases.updateDdl)
  249. *
  250. * @param string $database Required. The database to update.
  251. * @param UpdateDatabaseDdlRequest $postBody
  252. * @param array $optParams Optional parameters.
  253. * @return Operation
  254. */
  255. public function updateDdl($database, UpdateDatabaseDdlRequest $postBody, $optParams = [])
  256. {
  257. $params = ['database' => $database, 'postBody' => $postBody];
  258. $params = array_merge($params, $optParams);
  259. return $this->call('updateDdl', [$params], Operation::class);
  260. }
  261. }
  262. // Adding a class alias for backwards compatibility with the previous class name.
  263. class_alias(ProjectsInstancesDatabases::class, 'Google_Service_Spanner_Resource_ProjectsInstancesDatabases');