google-cloud-sql 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. google/cloud/sqladmin/__init__.py +605 -0
  2. google/cloud/sqladmin/gapic_version.py +16 -0
  3. google/cloud/sqladmin/py.typed +2 -0
  4. google/cloud/sqladmin_v1/__init__.py +616 -0
  5. google/cloud/sqladmin_v1/_compat.py +262 -0
  6. google/cloud/sqladmin_v1/gapic_metadata.json +959 -0
  7. google/cloud/sqladmin_v1/gapic_version.py +16 -0
  8. google/cloud/sqladmin_v1/py.typed +2 -0
  9. google/cloud/sqladmin_v1/services/__init__.py +15 -0
  10. google/cloud/sqladmin_v1/services/sql_available_database_versions_service/__init__.py +22 -0
  11. google/cloud/sqladmin_v1/services/sql_available_database_versions_service/async_client.py +336 -0
  12. google/cloud/sqladmin_v1/services/sql_available_database_versions_service/client.py +613 -0
  13. google/cloud/sqladmin_v1/services/sql_available_database_versions_service/transports/__init__.py +34 -0
  14. google/cloud/sqladmin_v1/services/sql_available_database_versions_service/transports/base.py +159 -0
  15. google/cloud/sqladmin_v1/services/sql_available_database_versions_service/transports/grpc.py +339 -0
  16. google/cloud/sqladmin_v1/services/sql_available_database_versions_service/transports/grpc_asyncio.py +356 -0
  17. google/cloud/sqladmin_v1/services/sql_backup_runs_service/__init__.py +22 -0
  18. google/cloud/sqladmin_v1/services/sql_backup_runs_service/async_client.py +697 -0
  19. google/cloud/sqladmin_v1/services/sql_backup_runs_service/client.py +977 -0
  20. google/cloud/sqladmin_v1/services/sql_backup_runs_service/pagers.py +199 -0
  21. google/cloud/sqladmin_v1/services/sql_backup_runs_service/transports/__init__.py +32 -0
  22. google/cloud/sqladmin_v1/services/sql_backup_runs_service/transports/base.py +225 -0
  23. google/cloud/sqladmin_v1/services/sql_backup_runs_service/transports/grpc.py +456 -0
  24. google/cloud/sqladmin_v1/services/sql_backup_runs_service/transports/grpc_asyncio.py +495 -0
  25. google/cloud/sqladmin_v1/services/sql_backups_service/__init__.py +22 -0
  26. google/cloud/sqladmin_v1/services/sql_backups_service/async_client.py +946 -0
  27. google/cloud/sqladmin_v1/services/sql_backups_service/client.py +1244 -0
  28. google/cloud/sqladmin_v1/services/sql_backups_service/pagers.py +197 -0
  29. google/cloud/sqladmin_v1/services/sql_backups_service/transports/__init__.py +32 -0
  30. google/cloud/sqladmin_v1/services/sql_backups_service/transports/base.py +237 -0
  31. google/cloud/sqladmin_v1/services/sql_backups_service/transports/grpc.py +478 -0
  32. google/cloud/sqladmin_v1/services/sql_backups_service/transports/grpc_asyncio.py +527 -0
  33. google/cloud/sqladmin_v1/services/sql_connect_service/__init__.py +22 -0
  34. google/cloud/sqladmin_v1/services/sql_connect_service/async_client.py +591 -0
  35. google/cloud/sqladmin_v1/services/sql_connect_service/client.py +867 -0
  36. google/cloud/sqladmin_v1/services/sql_connect_service/transports/__init__.py +32 -0
  37. google/cloud/sqladmin_v1/services/sql_connect_service/transports/base.py +215 -0
  38. google/cloud/sqladmin_v1/services/sql_connect_service/transports/grpc.py +430 -0
  39. google/cloud/sqladmin_v1/services/sql_connect_service/transports/grpc_asyncio.py +464 -0
  40. google/cloud/sqladmin_v1/services/sql_databases_service/__init__.py +22 -0
  41. google/cloud/sqladmin_v1/services/sql_databases_service/async_client.py +872 -0
  42. google/cloud/sqladmin_v1/services/sql_databases_service/client.py +1152 -0
  43. google/cloud/sqladmin_v1/services/sql_databases_service/transports/__init__.py +32 -0
  44. google/cloud/sqladmin_v1/services/sql_databases_service/transports/base.py +251 -0
  45. google/cloud/sqladmin_v1/services/sql_databases_service/transports/grpc.py +515 -0
  46. google/cloud/sqladmin_v1/services/sql_databases_service/transports/grpc_asyncio.py +568 -0
  47. google/cloud/sqladmin_v1/services/sql_events_service/__init__.py +22 -0
  48. google/cloud/sqladmin_v1/services/sql_events_service/async_client.py +311 -0
  49. google/cloud/sqladmin_v1/services/sql_events_service/client.py +593 -0
  50. google/cloud/sqladmin_v1/services/sql_events_service/transports/__init__.py +32 -0
  51. google/cloud/sqladmin_v1/services/sql_events_service/transports/base.py +159 -0
  52. google/cloud/sqladmin_v1/services/sql_events_service/transports/grpc.py +337 -0
  53. google/cloud/sqladmin_v1/services/sql_events_service/transports/grpc_asyncio.py +354 -0
  54. google/cloud/sqladmin_v1/services/sql_feature_eligibility_service/__init__.py +22 -0
  55. google/cloud/sqladmin_v1/services/sql_feature_eligibility_service/async_client.py +327 -0
  56. google/cloud/sqladmin_v1/services/sql_feature_eligibility_service/client.py +605 -0
  57. google/cloud/sqladmin_v1/services/sql_feature_eligibility_service/transports/__init__.py +32 -0
  58. google/cloud/sqladmin_v1/services/sql_feature_eligibility_service/transports/base.py +159 -0
  59. google/cloud/sqladmin_v1/services/sql_feature_eligibility_service/transports/grpc.py +337 -0
  60. google/cloud/sqladmin_v1/services/sql_feature_eligibility_service/transports/grpc_asyncio.py +356 -0
  61. google/cloud/sqladmin_v1/services/sql_flags_service/__init__.py +22 -0
  62. google/cloud/sqladmin_v1/services/sql_flags_service/async_client.py +386 -0
  63. google/cloud/sqladmin_v1/services/sql_flags_service/client.py +667 -0
  64. google/cloud/sqladmin_v1/services/sql_flags_service/transports/__init__.py +32 -0
  65. google/cloud/sqladmin_v1/services/sql_flags_service/transports/base.py +181 -0
  66. google/cloud/sqladmin_v1/services/sql_flags_service/transports/grpc.py +367 -0
  67. google/cloud/sqladmin_v1/services/sql_flags_service/transports/grpc_asyncio.py +391 -0
  68. google/cloud/sqladmin_v1/services/sql_iam_policies_service/__init__.py +22 -0
  69. google/cloud/sqladmin_v1/services/sql_iam_policies_service/async_client.py +315 -0
  70. google/cloud/sqladmin_v1/services/sql_iam_policies_service/client.py +593 -0
  71. google/cloud/sqladmin_v1/services/sql_iam_policies_service/transports/__init__.py +32 -0
  72. google/cloud/sqladmin_v1/services/sql_iam_policies_service/transports/base.py +159 -0
  73. google/cloud/sqladmin_v1/services/sql_iam_policies_service/transports/grpc.py +336 -0
  74. google/cloud/sqladmin_v1/services/sql_iam_policies_service/transports/grpc_asyncio.py +353 -0
  75. google/cloud/sqladmin_v1/services/sql_instance_names_service/__init__.py +22 -0
  76. google/cloud/sqladmin_v1/services/sql_instance_names_service/async_client.py +321 -0
  77. google/cloud/sqladmin_v1/services/sql_instance_names_service/client.py +595 -0
  78. google/cloud/sqladmin_v1/services/sql_instance_names_service/transports/__init__.py +32 -0
  79. google/cloud/sqladmin_v1/services/sql_instance_names_service/transports/base.py +159 -0
  80. google/cloud/sqladmin_v1/services/sql_instance_names_service/transports/grpc.py +336 -0
  81. google/cloud/sqladmin_v1/services/sql_instance_names_service/transports/grpc_asyncio.py +353 -0
  82. google/cloud/sqladmin_v1/services/sql_instances_service/__init__.py +22 -0
  83. google/cloud/sqladmin_v1/services/sql_instances_service/async_client.py +4519 -0
  84. google/cloud/sqladmin_v1/services/sql_instances_service/client.py +4833 -0
  85. google/cloud/sqladmin_v1/services/sql_instances_service/pagers.py +197 -0
  86. google/cloud/sqladmin_v1/services/sql_instances_service/transports/__init__.py +32 -0
  87. google/cloud/sqladmin_v1/services/sql_instances_service/transports/base.py +801 -0
  88. google/cloud/sqladmin_v1/services/sql_instances_service/transports/grpc.py +1661 -0
  89. google/cloud/sqladmin_v1/services/sql_instances_service/transports/grpc_asyncio.py +1904 -0
  90. google/cloud/sqladmin_v1/services/sql_operations_service/__init__.py +22 -0
  91. google/cloud/sqladmin_v1/services/sql_operations_service/async_client.py +591 -0
  92. google/cloud/sqladmin_v1/services/sql_operations_service/client.py +871 -0
  93. google/cloud/sqladmin_v1/services/sql_operations_service/pagers.py +197 -0
  94. google/cloud/sqladmin_v1/services/sql_operations_service/transports/__init__.py +32 -0
  95. google/cloud/sqladmin_v1/services/sql_operations_service/transports/base.py +210 -0
  96. google/cloud/sqladmin_v1/services/sql_operations_service/transports/grpc.py +426 -0
  97. google/cloud/sqladmin_v1/services/sql_operations_service/transports/grpc_asyncio.py +462 -0
  98. google/cloud/sqladmin_v1/services/sql_regions_service/__init__.py +22 -0
  99. google/cloud/sqladmin_v1/services/sql_regions_service/async_client.py +314 -0
  100. google/cloud/sqladmin_v1/services/sql_regions_service/client.py +596 -0
  101. google/cloud/sqladmin_v1/services/sql_regions_service/transports/__init__.py +32 -0
  102. google/cloud/sqladmin_v1/services/sql_regions_service/transports/base.py +159 -0
  103. google/cloud/sqladmin_v1/services/sql_regions_service/transports/grpc.py +338 -0
  104. google/cloud/sqladmin_v1/services/sql_regions_service/transports/grpc_asyncio.py +355 -0
  105. google/cloud/sqladmin_v1/services/sql_ssl_certs_service/__init__.py +22 -0
  106. google/cloud/sqladmin_v1/services/sql_ssl_certs_service/async_client.py +680 -0
  107. google/cloud/sqladmin_v1/services/sql_ssl_certs_service/client.py +960 -0
  108. google/cloud/sqladmin_v1/services/sql_ssl_certs_service/transports/__init__.py +32 -0
  109. google/cloud/sqladmin_v1/services/sql_ssl_certs_service/transports/base.py +226 -0
  110. google/cloud/sqladmin_v1/services/sql_ssl_certs_service/transports/grpc.py +461 -0
  111. google/cloud/sqladmin_v1/services/sql_ssl_certs_service/transports/grpc_asyncio.py +501 -0
  112. google/cloud/sqladmin_v1/services/sql_tiers_service/__init__.py +22 -0
  113. google/cloud/sqladmin_v1/services/sql_tiers_service/async_client.py +395 -0
  114. google/cloud/sqladmin_v1/services/sql_tiers_service/client.py +676 -0
  115. google/cloud/sqladmin_v1/services/sql_tiers_service/transports/__init__.py +32 -0
  116. google/cloud/sqladmin_v1/services/sql_tiers_service/transports/base.py +181 -0
  117. google/cloud/sqladmin_v1/services/sql_tiers_service/transports/grpc.py +369 -0
  118. google/cloud/sqladmin_v1/services/sql_tiers_service/transports/grpc_asyncio.py +393 -0
  119. google/cloud/sqladmin_v1/services/sql_users_service/__init__.py +22 -0
  120. google/cloud/sqladmin_v1/services/sql_users_service/async_client.py +754 -0
  121. google/cloud/sqladmin_v1/services/sql_users_service/client.py +1035 -0
  122. google/cloud/sqladmin_v1/services/sql_users_service/transports/__init__.py +32 -0
  123. google/cloud/sqladmin_v1/services/sql_users_service/transports/base.py +237 -0
  124. google/cloud/sqladmin_v1/services/sql_users_service/transports/grpc.py +477 -0
  125. google/cloud/sqladmin_v1/services/sql_users_service/transports/grpc_asyncio.py +526 -0
  126. google/cloud/sqladmin_v1/types/__init__.py +472 -0
  127. google/cloud/sqladmin_v1/types/cloud_sql_available_database_versions.py +24 -0
  128. google/cloud/sqladmin_v1/types/cloud_sql_backup_runs.py +438 -0
  129. google/cloud/sqladmin_v1/types/cloud_sql_backups.py +467 -0
  130. google/cloud/sqladmin_v1/types/cloud_sql_connect.py +385 -0
  131. google/cloud/sqladmin_v1/types/cloud_sql_databases.py +202 -0
  132. google/cloud/sqladmin_v1/types/cloud_sql_events.py +24 -0
  133. google/cloud/sqladmin_v1/types/cloud_sql_feature_eligibility.py +24 -0
  134. google/cloud/sqladmin_v1/types/cloud_sql_flags.py +272 -0
  135. google/cloud/sqladmin_v1/types/cloud_sql_iam_policies.py +24 -0
  136. google/cloud/sqladmin_v1/types/cloud_sql_instance_names.py +24 -0
  137. google/cloud/sqladmin_v1/types/cloud_sql_instances.py +4514 -0
  138. google/cloud/sqladmin_v1/types/cloud_sql_operations.py +164 -0
  139. google/cloud/sqladmin_v1/types/cloud_sql_regions.py +24 -0
  140. google/cloud/sqladmin_v1/types/cloud_sql_resources.py +4678 -0
  141. google/cloud/sqladmin_v1/types/cloud_sql_ssl_certs.py +220 -0
  142. google/cloud/sqladmin_v1/types/cloud_sql_tiers.py +108 -0
  143. google/cloud/sqladmin_v1/types/cloud_sql_users.py +571 -0
  144. google/cloud/sqladmin_v1beta4/__init__.py +583 -0
  145. google/cloud/sqladmin_v1beta4/_compat.py +262 -0
  146. google/cloud/sqladmin_v1beta4/gapic_metadata.json +1371 -0
  147. google/cloud/sqladmin_v1beta4/gapic_version.py +16 -0
  148. google/cloud/sqladmin_v1beta4/py.typed +2 -0
  149. google/cloud/sqladmin_v1beta4/services/__init__.py +15 -0
  150. google/cloud/sqladmin_v1beta4/services/sql_backup_runs_service/__init__.py +22 -0
  151. google/cloud/sqladmin_v1beta4/services/sql_backup_runs_service/async_client.py +689 -0
  152. google/cloud/sqladmin_v1beta4/services/sql_backup_runs_service/client.py +971 -0
  153. google/cloud/sqladmin_v1beta4/services/sql_backup_runs_service/pagers.py +197 -0
  154. google/cloud/sqladmin_v1beta4/services/sql_backup_runs_service/transports/__init__.py +36 -0
  155. google/cloud/sqladmin_v1beta4/services/sql_backup_runs_service/transports/base.py +223 -0
  156. google/cloud/sqladmin_v1beta4/services/sql_backup_runs_service/transports/grpc.py +449 -0
  157. google/cloud/sqladmin_v1beta4/services/sql_backup_runs_service/transports/grpc_asyncio.py +490 -0
  158. google/cloud/sqladmin_v1beta4/services/sql_backup_runs_service/transports/rest.py +1038 -0
  159. google/cloud/sqladmin_v1beta4/services/sql_backup_runs_service/transports/rest_base.py +150 -0
  160. google/cloud/sqladmin_v1beta4/services/sql_backups_service/__init__.py +22 -0
  161. google/cloud/sqladmin_v1beta4/services/sql_backups_service/async_client.py +941 -0
  162. google/cloud/sqladmin_v1beta4/services/sql_backups_service/client.py +1241 -0
  163. google/cloud/sqladmin_v1beta4/services/sql_backups_service/pagers.py +197 -0
  164. google/cloud/sqladmin_v1beta4/services/sql_backups_service/transports/__init__.py +36 -0
  165. google/cloud/sqladmin_v1beta4/services/sql_backups_service/transports/base.py +234 -0
  166. google/cloud/sqladmin_v1beta4/services/sql_backups_service/transports/grpc.py +470 -0
  167. google/cloud/sqladmin_v1beta4/services/sql_backups_service/transports/grpc_asyncio.py +521 -0
  168. google/cloud/sqladmin_v1beta4/services/sql_backups_service/transports/rest.py +1238 -0
  169. google/cloud/sqladmin_v1beta4/services/sql_backups_service/transports/rest_base.py +175 -0
  170. google/cloud/sqladmin_v1beta4/services/sql_connect_service/__init__.py +22 -0
  171. google/cloud/sqladmin_v1beta4/services/sql_connect_service/async_client.py +591 -0
  172. google/cloud/sqladmin_v1beta4/services/sql_connect_service/client.py +869 -0
  173. google/cloud/sqladmin_v1beta4/services/sql_connect_service/transports/__init__.py +36 -0
  174. google/cloud/sqladmin_v1beta4/services/sql_connect_service/transports/base.py +215 -0
  175. google/cloud/sqladmin_v1beta4/services/sql_connect_service/transports/grpc.py +430 -0
  176. google/cloud/sqladmin_v1beta4/services/sql_connect_service/transports/grpc_asyncio.py +464 -0
  177. google/cloud/sqladmin_v1beta4/services/sql_connect_service/transports/rest.py +852 -0
  178. google/cloud/sqladmin_v1beta4/services/sql_connect_service/transports/rest_base.py +138 -0
  179. google/cloud/sqladmin_v1beta4/services/sql_data_service/__init__.py +22 -0
  180. google/cloud/sqladmin_v1beta4/services/sql_data_service/async_client.py +444 -0
  181. google/cloud/sqladmin_v1beta4/services/sql_data_service/client.py +739 -0
  182. google/cloud/sqladmin_v1beta4/services/sql_data_service/transports/__init__.py +36 -0
  183. google/cloud/sqladmin_v1beta4/services/sql_data_service/transports/base.py +181 -0
  184. google/cloud/sqladmin_v1beta4/services/sql_data_service/transports/grpc.py +407 -0
  185. google/cloud/sqladmin_v1beta4/services/sql_data_service/transports/grpc_asyncio.py +431 -0
  186. google/cloud/sqladmin_v1beta4/services/sql_data_service/transports/rest.py +213 -0
  187. google/cloud/sqladmin_v1beta4/services/sql_data_service/transports/rest_base.py +97 -0
  188. google/cloud/sqladmin_v1beta4/services/sql_databases_service/__init__.py +22 -0
  189. google/cloud/sqladmin_v1beta4/services/sql_databases_service/async_client.py +860 -0
  190. google/cloud/sqladmin_v1beta4/services/sql_databases_service/client.py +1142 -0
  191. google/cloud/sqladmin_v1beta4/services/sql_databases_service/transports/__init__.py +36 -0
  192. google/cloud/sqladmin_v1beta4/services/sql_databases_service/transports/base.py +251 -0
  193. google/cloud/sqladmin_v1beta4/services/sql_databases_service/transports/grpc.py +502 -0
  194. google/cloud/sqladmin_v1beta4/services/sql_databases_service/transports/grpc_asyncio.py +561 -0
  195. google/cloud/sqladmin_v1beta4/services/sql_databases_service/transports/rest.py +1468 -0
  196. google/cloud/sqladmin_v1beta4/services/sql_databases_service/transports/rest_base.py +180 -0
  197. google/cloud/sqladmin_v1beta4/services/sql_flags_service/__init__.py +22 -0
  198. google/cloud/sqladmin_v1beta4/services/sql_flags_service/async_client.py +386 -0
  199. google/cloud/sqladmin_v1beta4/services/sql_flags_service/client.py +669 -0
  200. google/cloud/sqladmin_v1beta4/services/sql_flags_service/transports/__init__.py +36 -0
  201. google/cloud/sqladmin_v1beta4/services/sql_flags_service/transports/base.py +181 -0
  202. google/cloud/sqladmin_v1beta4/services/sql_flags_service/transports/grpc.py +365 -0
  203. google/cloud/sqladmin_v1beta4/services/sql_flags_service/transports/grpc_asyncio.py +389 -0
  204. google/cloud/sqladmin_v1beta4/services/sql_flags_service/transports/rest.py +392 -0
  205. google/cloud/sqladmin_v1beta4/services/sql_flags_service/transports/rest_base.py +107 -0
  206. google/cloud/sqladmin_v1beta4/services/sql_iam_policies_service/__init__.py +22 -0
  207. google/cloud/sqladmin_v1beta4/services/sql_iam_policies_service/async_client.py +315 -0
  208. google/cloud/sqladmin_v1beta4/services/sql_iam_policies_service/client.py +595 -0
  209. google/cloud/sqladmin_v1beta4/services/sql_iam_policies_service/transports/__init__.py +39 -0
  210. google/cloud/sqladmin_v1beta4/services/sql_iam_policies_service/transports/base.py +159 -0
  211. google/cloud/sqladmin_v1beta4/services/sql_iam_policies_service/transports/grpc.py +336 -0
  212. google/cloud/sqladmin_v1beta4/services/sql_iam_policies_service/transports/grpc_asyncio.py +353 -0
  213. google/cloud/sqladmin_v1beta4/services/sql_iam_policies_service/transports/rest.py +184 -0
  214. google/cloud/sqladmin_v1beta4/services/sql_iam_policies_service/transports/rest_base.py +91 -0
  215. google/cloud/sqladmin_v1beta4/services/sql_instances_service/__init__.py +22 -0
  216. google/cloud/sqladmin_v1beta4/services/sql_instances_service/async_client.py +4399 -0
  217. google/cloud/sqladmin_v1beta4/services/sql_instances_service/client.py +4715 -0
  218. google/cloud/sqladmin_v1beta4/services/sql_instances_service/pagers.py +197 -0
  219. google/cloud/sqladmin_v1beta4/services/sql_instances_service/transports/__init__.py +36 -0
  220. google/cloud/sqladmin_v1beta4/services/sql_instances_service/transports/base.py +801 -0
  221. google/cloud/sqladmin_v1beta4/services/sql_instances_service/transports/grpc.py +1627 -0
  222. google/cloud/sqladmin_v1beta4/services/sql_instances_service/transports/grpc_asyncio.py +1895 -0
  223. google/cloud/sqladmin_v1beta4/services/sql_instances_service/transports/rest.py +9625 -0
  224. google/cloud/sqladmin_v1beta4/services/sql_instances_service/transports/rest_base.py +744 -0
  225. google/cloud/sqladmin_v1beta4/services/sql_operations_service/__init__.py +22 -0
  226. google/cloud/sqladmin_v1beta4/services/sql_operations_service/async_client.py +585 -0
  227. google/cloud/sqladmin_v1beta4/services/sql_operations_service/client.py +867 -0
  228. google/cloud/sqladmin_v1beta4/services/sql_operations_service/pagers.py +197 -0
  229. google/cloud/sqladmin_v1beta4/services/sql_operations_service/transports/__init__.py +36 -0
  230. google/cloud/sqladmin_v1beta4/services/sql_operations_service/transports/base.py +210 -0
  231. google/cloud/sqladmin_v1beta4/services/sql_operations_service/transports/grpc.py +422 -0
  232. google/cloud/sqladmin_v1beta4/services/sql_operations_service/transports/grpc_asyncio.py +458 -0
  233. google/cloud/sqladmin_v1beta4/services/sql_operations_service/transports/rest.py +744 -0
  234. google/cloud/sqladmin_v1beta4/services/sql_operations_service/transports/rest_base.py +136 -0
  235. google/cloud/sqladmin_v1beta4/services/sql_ssl_certs_service/__init__.py +22 -0
  236. google/cloud/sqladmin_v1beta4/services/sql_ssl_certs_service/async_client.py +672 -0
  237. google/cloud/sqladmin_v1beta4/services/sql_ssl_certs_service/client.py +954 -0
  238. google/cloud/sqladmin_v1beta4/services/sql_ssl_certs_service/transports/__init__.py +36 -0
  239. google/cloud/sqladmin_v1beta4/services/sql_ssl_certs_service/transports/base.py +226 -0
  240. google/cloud/sqladmin_v1beta4/services/sql_ssl_certs_service/transports/grpc.py +453 -0
  241. google/cloud/sqladmin_v1beta4/services/sql_ssl_certs_service/transports/grpc_asyncio.py +497 -0
  242. google/cloud/sqladmin_v1beta4/services/sql_ssl_certs_service/transports/rest.py +1036 -0
  243. google/cloud/sqladmin_v1beta4/services/sql_ssl_certs_service/transports/rest_base.py +150 -0
  244. google/cloud/sqladmin_v1beta4/services/sql_tiers_service/__init__.py +22 -0
  245. google/cloud/sqladmin_v1beta4/services/sql_tiers_service/async_client.py +393 -0
  246. google/cloud/sqladmin_v1beta4/services/sql_tiers_service/client.py +676 -0
  247. google/cloud/sqladmin_v1beta4/services/sql_tiers_service/transports/__init__.py +36 -0
  248. google/cloud/sqladmin_v1beta4/services/sql_tiers_service/transports/base.py +181 -0
  249. google/cloud/sqladmin_v1beta4/services/sql_tiers_service/transports/grpc.py +368 -0
  250. google/cloud/sqladmin_v1beta4/services/sql_tiers_service/transports/grpc_asyncio.py +392 -0
  251. google/cloud/sqladmin_v1beta4/services/sql_tiers_service/transports/rest.py +396 -0
  252. google/cloud/sqladmin_v1beta4/services/sql_tiers_service/transports/rest_base.py +107 -0
  253. google/cloud/sqladmin_v1beta4/services/sql_users_service/__init__.py +22 -0
  254. google/cloud/sqladmin_v1beta4/services/sql_users_service/async_client.py +754 -0
  255. google/cloud/sqladmin_v1beta4/services/sql_users_service/client.py +1037 -0
  256. google/cloud/sqladmin_v1beta4/services/sql_users_service/transports/__init__.py +36 -0
  257. google/cloud/sqladmin_v1beta4/services/sql_users_service/transports/base.py +237 -0
  258. google/cloud/sqladmin_v1beta4/services/sql_users_service/transports/grpc.py +475 -0
  259. google/cloud/sqladmin_v1beta4/services/sql_users_service/transports/grpc_asyncio.py +524 -0
  260. google/cloud/sqladmin_v1beta4/services/sql_users_service/transports/rest.py +1249 -0
  261. google/cloud/sqladmin_v1beta4/services/sql_users_service/transports/rest_base.py +165 -0
  262. google/cloud/sqladmin_v1beta4/types/__init__.py +480 -0
  263. google/cloud/sqladmin_v1beta4/types/cloud_sql.py +2666 -0
  264. google/cloud/sqladmin_v1beta4/types/cloud_sql_connect.py +386 -0
  265. google/cloud/sqladmin_v1beta4/types/cloud_sql_data.py +339 -0
  266. google/cloud/sqladmin_v1beta4/types/cloud_sql_iam_policies.py +24 -0
  267. google/cloud/sqladmin_v1beta4/types/cloud_sql_resources.py +8111 -0
  268. google/cloud/sqladmin_v1beta4/types/cloud_sql_tiers.py +108 -0
  269. google/cloud/sqladmin_v1beta4/types/cloud_sql_users.py +573 -0
  270. google_cloud_sql-0.1.1.dist-info/METADATA +239 -0
  271. google_cloud_sql-0.1.1.dist-info/RECORD +274 -0
  272. google_cloud_sql-0.1.1.dist-info/WHEEL +5 -0
  273. google_cloud_sql-0.1.1.dist-info/licenses/LICENSE +202 -0
  274. google_cloud_sql-0.1.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,4399 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2026 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ import logging as std_logging
17
+ import re
18
+ from collections import OrderedDict
19
+ from typing import (
20
+ Callable,
21
+ Dict,
22
+ Mapping,
23
+ MutableMapping,
24
+ MutableSequence,
25
+ Optional,
26
+ Sequence,
27
+ Tuple,
28
+ Type,
29
+ Union,
30
+ )
31
+
32
+ import google.protobuf
33
+ from google.api_core import exceptions as core_exceptions
34
+ from google.api_core import gapic_v1
35
+ from google.api_core import retry_async as retries
36
+ from google.api_core.client_options import ClientOptions
37
+ from google.auth import credentials as ga_credentials # type: ignore
38
+ from google.oauth2 import service_account # type: ignore
39
+
40
+ from google.cloud.sqladmin_v1beta4 import gapic_version as package_version
41
+
42
+ try:
43
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
44
+ except AttributeError: # pragma: NO COVER
45
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
46
+
47
+ import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
48
+ import google.protobuf.wrappers_pb2 as wrappers_pb2 # type: ignore
49
+ import google.rpc.status_pb2 as status_pb2 # type: ignore
50
+ from google.cloud.location import locations_pb2 # type: ignore
51
+ from google.longrunning import operations_pb2 # type: ignore
52
+
53
+ from google.cloud.sqladmin_v1beta4.services.sql_instances_service import pagers
54
+ from google.cloud.sqladmin_v1beta4.types import cloud_sql, cloud_sql_resources
55
+
56
+ from .client import SqlInstancesServiceClient
57
+ from .transports.base import DEFAULT_CLIENT_INFO, SqlInstancesServiceTransport
58
+ from .transports.grpc_asyncio import SqlInstancesServiceGrpcAsyncIOTransport
59
+
60
+ try:
61
+ from google.api_core import client_logging # type: ignore
62
+
63
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
64
+ except ImportError: # pragma: NO COVER
65
+ CLIENT_LOGGING_SUPPORTED = False
66
+
67
+ _LOGGER = std_logging.getLogger(__name__)
68
+
69
+
70
+ class SqlInstancesServiceAsyncClient:
71
+ """"""
72
+
73
+ _client: SqlInstancesServiceClient
74
+
75
+ # Copy defaults from the synchronous client for use here.
76
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
77
+ DEFAULT_ENDPOINT = SqlInstancesServiceClient.DEFAULT_ENDPOINT
78
+ DEFAULT_MTLS_ENDPOINT = SqlInstancesServiceClient.DEFAULT_MTLS_ENDPOINT
79
+ _DEFAULT_ENDPOINT_TEMPLATE = SqlInstancesServiceClient._DEFAULT_ENDPOINT_TEMPLATE
80
+ _DEFAULT_UNIVERSE = SqlInstancesServiceClient._DEFAULT_UNIVERSE
81
+
82
+ backup_path = staticmethod(SqlInstancesServiceClient.backup_path)
83
+ parse_backup_path = staticmethod(SqlInstancesServiceClient.parse_backup_path)
84
+ backup_dr_backup_path = staticmethod(
85
+ SqlInstancesServiceClient.backup_dr_backup_path
86
+ )
87
+ parse_backup_dr_backup_path = staticmethod(
88
+ SqlInstancesServiceClient.parse_backup_dr_backup_path
89
+ )
90
+ network_path = staticmethod(SqlInstancesServiceClient.network_path)
91
+ parse_network_path = staticmethod(SqlInstancesServiceClient.parse_network_path)
92
+ secret_version_path = staticmethod(SqlInstancesServiceClient.secret_version_path)
93
+ parse_secret_version_path = staticmethod(
94
+ SqlInstancesServiceClient.parse_secret_version_path
95
+ )
96
+ service_connection_policy_path = staticmethod(
97
+ SqlInstancesServiceClient.service_connection_policy_path
98
+ )
99
+ parse_service_connection_policy_path = staticmethod(
100
+ SqlInstancesServiceClient.parse_service_connection_policy_path
101
+ )
102
+ common_billing_account_path = staticmethod(
103
+ SqlInstancesServiceClient.common_billing_account_path
104
+ )
105
+ parse_common_billing_account_path = staticmethod(
106
+ SqlInstancesServiceClient.parse_common_billing_account_path
107
+ )
108
+ common_folder_path = staticmethod(SqlInstancesServiceClient.common_folder_path)
109
+ parse_common_folder_path = staticmethod(
110
+ SqlInstancesServiceClient.parse_common_folder_path
111
+ )
112
+ common_organization_path = staticmethod(
113
+ SqlInstancesServiceClient.common_organization_path
114
+ )
115
+ parse_common_organization_path = staticmethod(
116
+ SqlInstancesServiceClient.parse_common_organization_path
117
+ )
118
+ common_project_path = staticmethod(SqlInstancesServiceClient.common_project_path)
119
+ parse_common_project_path = staticmethod(
120
+ SqlInstancesServiceClient.parse_common_project_path
121
+ )
122
+ common_location_path = staticmethod(SqlInstancesServiceClient.common_location_path)
123
+ parse_common_location_path = staticmethod(
124
+ SqlInstancesServiceClient.parse_common_location_path
125
+ )
126
+
127
+ @classmethod
128
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
129
+ """Creates an instance of this client using the provided credentials
130
+ info.
131
+
132
+ Args:
133
+ info (dict): The service account private key info.
134
+ args: Additional arguments to pass to the constructor.
135
+ kwargs: Additional arguments to pass to the constructor.
136
+
137
+ Returns:
138
+ SqlInstancesServiceAsyncClient: The constructed client.
139
+ """
140
+ sa_info_func = (
141
+ SqlInstancesServiceClient.from_service_account_info.__func__ # type: ignore
142
+ )
143
+ return sa_info_func(SqlInstancesServiceAsyncClient, info, *args, **kwargs)
144
+
145
+ @classmethod
146
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
147
+ """Creates an instance of this client using the provided credentials
148
+ file.
149
+
150
+ Args:
151
+ filename (str): The path to the service account private key json
152
+ file.
153
+ args: Additional arguments to pass to the constructor.
154
+ kwargs: Additional arguments to pass to the constructor.
155
+
156
+ Returns:
157
+ SqlInstancesServiceAsyncClient: The constructed client.
158
+ """
159
+ sa_file_func = (
160
+ SqlInstancesServiceClient.from_service_account_file.__func__ # type: ignore
161
+ )
162
+ return sa_file_func(SqlInstancesServiceAsyncClient, filename, *args, **kwargs)
163
+
164
+ from_service_account_json = from_service_account_file
165
+
166
+ @classmethod
167
+ def get_mtls_endpoint_and_cert_source(
168
+ cls, client_options: Optional[ClientOptions] = None
169
+ ):
170
+ """Return the API endpoint and client cert source for mutual TLS.
171
+
172
+ The client cert source is determined in the following order:
173
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
174
+ client cert source is None.
175
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
176
+ default client cert source exists, use the default one; otherwise the client cert
177
+ source is None.
178
+
179
+ The API endpoint is determined in the following order:
180
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
181
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
182
+ default mTLS endpoint; if the environment variable is "never", use the default API
183
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
184
+ use the default API endpoint.
185
+
186
+ More details can be found at https://google.aip.dev/auth/4114.
187
+
188
+ Args:
189
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
190
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
191
+ in this method.
192
+
193
+ Returns:
194
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
195
+ client cert source to use.
196
+
197
+ Raises:
198
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
199
+ """
200
+ return SqlInstancesServiceClient.get_mtls_endpoint_and_cert_source(
201
+ client_options
202
+ ) # type: ignore
203
+
204
+ @property
205
+ def transport(self) -> SqlInstancesServiceTransport:
206
+ """Returns the transport used by the client instance.
207
+
208
+ Returns:
209
+ SqlInstancesServiceTransport: The transport used by the client instance.
210
+ """
211
+ return self._client.transport
212
+
213
+ @property
214
+ def api_endpoint(self) -> str:
215
+ """Return the API endpoint used by the client instance.
216
+
217
+ Returns:
218
+ str: The API endpoint used by the client instance.
219
+ """
220
+ return self._client._api_endpoint
221
+
222
+ @property
223
+ def universe_domain(self) -> str:
224
+ """Return the universe domain used by the client instance.
225
+
226
+ Returns:
227
+ str: The universe domain used
228
+ by the client instance.
229
+ """
230
+ return self._client._universe_domain
231
+
232
+ get_transport_class = SqlInstancesServiceClient.get_transport_class
233
+
234
+ def __init__(
235
+ self,
236
+ *,
237
+ credentials: Optional[ga_credentials.Credentials] = None,
238
+ transport: Optional[
239
+ Union[
240
+ str,
241
+ SqlInstancesServiceTransport,
242
+ Callable[..., SqlInstancesServiceTransport],
243
+ ]
244
+ ] = "grpc_asyncio",
245
+ client_options: Optional[ClientOptions] = None,
246
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
247
+ ) -> None:
248
+ """Instantiates the sql instances service async client.
249
+
250
+ Args:
251
+ credentials (Optional[google.auth.credentials.Credentials]): The
252
+ authorization credentials to attach to requests. These
253
+ credentials identify the application to the service; if none
254
+ are specified, the client will attempt to ascertain the
255
+ credentials from the environment.
256
+ transport (Optional[Union[str,SqlInstancesServiceTransport,Callable[..., SqlInstancesServiceTransport]]]):
257
+ The transport to use, or a Callable that constructs and returns a new transport to use.
258
+ If a Callable is given, it will be called with the same set of initialization
259
+ arguments as used in the SqlInstancesServiceTransport constructor.
260
+ If set to None, a transport is chosen automatically.
261
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
262
+ Custom options for the client.
263
+
264
+ 1. The ``api_endpoint`` property can be used to override the
265
+ default endpoint provided by the client when ``transport`` is
266
+ not explicitly provided. Only if this property is not set and
267
+ ``transport`` was not explicitly provided, the endpoint is
268
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
269
+ variable, which have one of the following values:
270
+ "always" (always use the default mTLS endpoint), "never" (always
271
+ use the default regular endpoint) and "auto" (auto-switch to the
272
+ default mTLS endpoint if client certificate is present; this is
273
+ the default value).
274
+
275
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
276
+ is "true", then the ``client_cert_source`` property can be used
277
+ to provide a client certificate for mTLS transport. If
278
+ not provided, the default SSL client certificate will be used if
279
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
280
+ set, no client certificate will be used.
281
+
282
+ 3. The ``universe_domain`` property can be used to override the
283
+ default "googleapis.com" universe. Note that ``api_endpoint``
284
+ property still takes precedence; and ``universe_domain`` is
285
+ currently not supported for mTLS.
286
+
287
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
288
+ The client info used to send a user-agent string along with
289
+ API requests. If ``None``, then default info will be used.
290
+ Generally, you only need to set this if you're developing
291
+ your own client library.
292
+
293
+ Raises:
294
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
295
+ creation failed for any reason.
296
+ """
297
+ self._client = SqlInstancesServiceClient(
298
+ credentials=credentials,
299
+ transport=transport,
300
+ client_options=client_options,
301
+ client_info=client_info,
302
+ )
303
+
304
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
305
+ std_logging.DEBUG
306
+ ): # pragma: NO COVER
307
+ _LOGGER.debug(
308
+ "Created client `google.cloud.sql_v1beta4.SqlInstancesServiceAsyncClient`.",
309
+ extra={
310
+ "serviceName": "google.cloud.sql.v1beta4.SqlInstancesService",
311
+ "universeDomain": getattr(
312
+ self._client._transport._credentials, "universe_domain", ""
313
+ ),
314
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
315
+ "credentialsInfo": getattr(
316
+ self.transport._credentials, "get_cred_info", lambda: None
317
+ )(),
318
+ }
319
+ if hasattr(self._client._transport, "_credentials")
320
+ else {
321
+ "serviceName": "google.cloud.sql.v1beta4.SqlInstancesService",
322
+ "credentialsType": None,
323
+ },
324
+ )
325
+
326
+ async def add_server_ca(
327
+ self,
328
+ request: Optional[Union[cloud_sql.SqlInstancesAddServerCaRequest, dict]] = None,
329
+ *,
330
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
331
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
332
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
333
+ ) -> cloud_sql_resources.Operation:
334
+ r"""Add a new trusted Certificate Authority (CA) version
335
+ for the specified instance. Required to prepare for a
336
+ certificate rotation. If a CA version was previously
337
+ added but never used in a certificate rotation, this
338
+ operation replaces that version. There cannot be more
339
+ than one CA version waiting to be rotated in. For
340
+ instances that have enabled Certificate Authority
341
+ Service (CAS) based server CA, use AddServerCertificate
342
+ to add a new server certificate.
343
+
344
+ .. code-block:: python
345
+
346
+ # This snippet has been automatically generated and should be regarded as a
347
+ # code template only.
348
+ # It will require modifications to work:
349
+ # - It may require correct/in-range values for request initialization.
350
+ # - It may require specifying regional endpoints when creating the service
351
+ # client as shown in:
352
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
353
+ from google.cloud import sqladmin_v1beta4
354
+
355
+ async def sample_add_server_ca():
356
+ # Create a client
357
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
358
+
359
+ # Initialize request argument(s)
360
+ request = sqladmin_v1beta4.SqlInstancesAddServerCaRequest(
361
+ )
362
+
363
+ # Make the request
364
+ response = await client.add_server_ca(request=request)
365
+
366
+ # Handle the response
367
+ print(response)
368
+
369
+ Args:
370
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesAddServerCaRequest, dict]]):
371
+ The request object.
372
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
373
+ should be retried.
374
+ timeout (float): The timeout for this request.
375
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
376
+ sent along with the request as metadata. Normally, each value must be of type `str`,
377
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
378
+ be of type `bytes`.
379
+
380
+ Returns:
381
+ google.cloud.sqladmin_v1beta4.types.Operation:
382
+ An Operation resource. For
383
+ successful operations that return an
384
+ Operation resource, only the fields
385
+ relevant to the operation are populated
386
+ in the resource.
387
+
388
+ """
389
+ # Create or coerce a protobuf request object.
390
+ # - Use the request object if provided (there's no risk of modifying the input as
391
+ # there are no flattened fields), or create one.
392
+ if not isinstance(request, cloud_sql.SqlInstancesAddServerCaRequest):
393
+ request = cloud_sql.SqlInstancesAddServerCaRequest(request)
394
+
395
+ # Wrap the RPC method; this adds retry and timeout information,
396
+ # and friendly error handling.
397
+ rpc = self._client._transport._wrapped_methods[
398
+ self._client._transport.add_server_ca
399
+ ]
400
+
401
+ # Certain fields should be provided within the metadata header;
402
+ # add these here.
403
+ metadata = tuple(metadata) + (
404
+ gapic_v1.routing_header.to_grpc_metadata(
405
+ (
406
+ ("project", request.project),
407
+ ("instance", request.instance),
408
+ )
409
+ ),
410
+ )
411
+
412
+ # Validate the universe domain.
413
+ self._client._validate_universe_domain()
414
+
415
+ # Send the request.
416
+ response = await rpc(
417
+ request,
418
+ retry=retry,
419
+ timeout=timeout,
420
+ metadata=metadata,
421
+ )
422
+
423
+ # Done; return the response.
424
+ return response
425
+
426
+ async def add_server_certificate(
427
+ self,
428
+ request: Optional[
429
+ Union[cloud_sql.SqlInstancesAddServerCertificateRequest, dict]
430
+ ] = None,
431
+ *,
432
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
433
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
434
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
435
+ ) -> cloud_sql_resources.Operation:
436
+ r"""Add a new trusted server certificate version for the
437
+ specified instance using Certificate Authority Service
438
+ (CAS) server CA. Required to prepare for a certificate
439
+ rotation. If a server certificate version was previously
440
+ added but never used in a certificate rotation, this
441
+ operation replaces that version. There cannot be more
442
+ than one certificate version waiting to be rotated in.
443
+ For instances not using CAS server CA, use AddServerCa
444
+ instead.
445
+
446
+ .. code-block:: python
447
+
448
+ # This snippet has been automatically generated and should be regarded as a
449
+ # code template only.
450
+ # It will require modifications to work:
451
+ # - It may require correct/in-range values for request initialization.
452
+ # - It may require specifying regional endpoints when creating the service
453
+ # client as shown in:
454
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
455
+ from google.cloud import sqladmin_v1beta4
456
+
457
+ async def sample_add_server_certificate():
458
+ # Create a client
459
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
460
+
461
+ # Initialize request argument(s)
462
+ request = sqladmin_v1beta4.SqlInstancesAddServerCertificateRequest(
463
+ instance="instance_value",
464
+ project="project_value",
465
+ )
466
+
467
+ # Make the request
468
+ response = await client.add_server_certificate(request=request)
469
+
470
+ # Handle the response
471
+ print(response)
472
+
473
+ Args:
474
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesAddServerCertificateRequest, dict]]):
475
+ The request object. Request for AddServerCertificate RPC.
476
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
477
+ should be retried.
478
+ timeout (float): The timeout for this request.
479
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
480
+ sent along with the request as metadata. Normally, each value must be of type `str`,
481
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
482
+ be of type `bytes`.
483
+
484
+ Returns:
485
+ google.cloud.sqladmin_v1beta4.types.Operation:
486
+ An Operation resource. For
487
+ successful operations that return an
488
+ Operation resource, only the fields
489
+ relevant to the operation are populated
490
+ in the resource.
491
+
492
+ """
493
+ # Create or coerce a protobuf request object.
494
+ # - Use the request object if provided (there's no risk of modifying the input as
495
+ # there are no flattened fields), or create one.
496
+ if not isinstance(request, cloud_sql.SqlInstancesAddServerCertificateRequest):
497
+ request = cloud_sql.SqlInstancesAddServerCertificateRequest(request)
498
+
499
+ # Wrap the RPC method; this adds retry and timeout information,
500
+ # and friendly error handling.
501
+ rpc = self._client._transport._wrapped_methods[
502
+ self._client._transport.add_server_certificate
503
+ ]
504
+
505
+ # Certain fields should be provided within the metadata header;
506
+ # add these here.
507
+ metadata = tuple(metadata) + (
508
+ gapic_v1.routing_header.to_grpc_metadata(
509
+ (
510
+ ("project", request.project),
511
+ ("instance", request.instance),
512
+ )
513
+ ),
514
+ )
515
+
516
+ # Validate the universe domain.
517
+ self._client._validate_universe_domain()
518
+
519
+ # Send the request.
520
+ response = await rpc(
521
+ request,
522
+ retry=retry,
523
+ timeout=timeout,
524
+ metadata=metadata,
525
+ )
526
+
527
+ # Done; return the response.
528
+ return response
529
+
530
+ async def add_entra_id_certificate(
531
+ self,
532
+ request: Optional[
533
+ Union[cloud_sql.SqlInstancesAddEntraIdCertificateRequest, dict]
534
+ ] = None,
535
+ *,
536
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
537
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
538
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
539
+ ) -> cloud_sql_resources.Operation:
540
+ r"""Adds a new Entra ID certificate for the specified
541
+ instance. If an Entra ID certificate was previously
542
+ added but never used in a certificate rotation, this
543
+ operation replaces that version.
544
+
545
+ .. code-block:: python
546
+
547
+ # This snippet has been automatically generated and should be regarded as a
548
+ # code template only.
549
+ # It will require modifications to work:
550
+ # - It may require correct/in-range values for request initialization.
551
+ # - It may require specifying regional endpoints when creating the service
552
+ # client as shown in:
553
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
554
+ from google.cloud import sqladmin_v1beta4
555
+
556
+ async def sample_add_entra_id_certificate():
557
+ # Create a client
558
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
559
+
560
+ # Initialize request argument(s)
561
+ request = sqladmin_v1beta4.SqlInstancesAddEntraIdCertificateRequest(
562
+ instance="instance_value",
563
+ project="project_value",
564
+ )
565
+
566
+ # Make the request
567
+ response = await client.add_entra_id_certificate(request=request)
568
+
569
+ # Handle the response
570
+ print(response)
571
+
572
+ Args:
573
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesAddEntraIdCertificateRequest, dict]]):
574
+ The request object. Request for AddEntraIdCertificate
575
+ RPC.
576
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
577
+ should be retried.
578
+ timeout (float): The timeout for this request.
579
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
580
+ sent along with the request as metadata. Normally, each value must be of type `str`,
581
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
582
+ be of type `bytes`.
583
+
584
+ Returns:
585
+ google.cloud.sqladmin_v1beta4.types.Operation:
586
+ An Operation resource. For
587
+ successful operations that return an
588
+ Operation resource, only the fields
589
+ relevant to the operation are populated
590
+ in the resource.
591
+
592
+ """
593
+ # Create or coerce a protobuf request object.
594
+ # - Use the request object if provided (there's no risk of modifying the input as
595
+ # there are no flattened fields), or create one.
596
+ if not isinstance(request, cloud_sql.SqlInstancesAddEntraIdCertificateRequest):
597
+ request = cloud_sql.SqlInstancesAddEntraIdCertificateRequest(request)
598
+
599
+ # Wrap the RPC method; this adds retry and timeout information,
600
+ # and friendly error handling.
601
+ rpc = self._client._transport._wrapped_methods[
602
+ self._client._transport.add_entra_id_certificate
603
+ ]
604
+
605
+ # Certain fields should be provided within the metadata header;
606
+ # add these here.
607
+ metadata = tuple(metadata) + (
608
+ gapic_v1.routing_header.to_grpc_metadata(
609
+ (
610
+ ("project", request.project),
611
+ ("instance", request.instance),
612
+ )
613
+ ),
614
+ )
615
+
616
+ # Validate the universe domain.
617
+ self._client._validate_universe_domain()
618
+
619
+ # Send the request.
620
+ response = await rpc(
621
+ request,
622
+ retry=retry,
623
+ timeout=timeout,
624
+ metadata=metadata,
625
+ )
626
+
627
+ # Done; return the response.
628
+ return response
629
+
630
+ async def clone(
631
+ self,
632
+ request: Optional[Union[cloud_sql.SqlInstancesCloneRequest, dict]] = None,
633
+ *,
634
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
635
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
636
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
637
+ ) -> cloud_sql_resources.Operation:
638
+ r"""Creates a Cloud SQL instance as a clone of the source
639
+ instance. Using this operation might cause your instance
640
+ to restart.
641
+
642
+ .. code-block:: python
643
+
644
+ # This snippet has been automatically generated and should be regarded as a
645
+ # code template only.
646
+ # It will require modifications to work:
647
+ # - It may require correct/in-range values for request initialization.
648
+ # - It may require specifying regional endpoints when creating the service
649
+ # client as shown in:
650
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
651
+ from google.cloud import sqladmin_v1beta4
652
+
653
+ async def sample_clone():
654
+ # Create a client
655
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
656
+
657
+ # Initialize request argument(s)
658
+ request = sqladmin_v1beta4.SqlInstancesCloneRequest(
659
+ )
660
+
661
+ # Make the request
662
+ response = await client.clone(request=request)
663
+
664
+ # Handle the response
665
+ print(response)
666
+
667
+ Args:
668
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesCloneRequest, dict]]):
669
+ The request object.
670
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
671
+ should be retried.
672
+ timeout (float): The timeout for this request.
673
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
674
+ sent along with the request as metadata. Normally, each value must be of type `str`,
675
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
676
+ be of type `bytes`.
677
+
678
+ Returns:
679
+ google.cloud.sqladmin_v1beta4.types.Operation:
680
+ An Operation resource. For
681
+ successful operations that return an
682
+ Operation resource, only the fields
683
+ relevant to the operation are populated
684
+ in the resource.
685
+
686
+ """
687
+ # Create or coerce a protobuf request object.
688
+ # - Use the request object if provided (there's no risk of modifying the input as
689
+ # there are no flattened fields), or create one.
690
+ if not isinstance(request, cloud_sql.SqlInstancesCloneRequest):
691
+ request = cloud_sql.SqlInstancesCloneRequest(request)
692
+
693
+ # Wrap the RPC method; this adds retry and timeout information,
694
+ # and friendly error handling.
695
+ rpc = self._client._transport._wrapped_methods[self._client._transport.clone]
696
+
697
+ # Certain fields should be provided within the metadata header;
698
+ # add these here.
699
+ metadata = tuple(metadata) + (
700
+ gapic_v1.routing_header.to_grpc_metadata(
701
+ (
702
+ ("project", request.project),
703
+ ("instance", request.instance),
704
+ )
705
+ ),
706
+ )
707
+
708
+ # Validate the universe domain.
709
+ self._client._validate_universe_domain()
710
+
711
+ # Send the request.
712
+ response = await rpc(
713
+ request,
714
+ retry=retry,
715
+ timeout=timeout,
716
+ metadata=metadata,
717
+ )
718
+
719
+ # Done; return the response.
720
+ return response
721
+
722
+ async def delete(
723
+ self,
724
+ request: Optional[Union[cloud_sql.SqlInstancesDeleteRequest, dict]] = None,
725
+ *,
726
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
727
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
728
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
729
+ ) -> cloud_sql_resources.Operation:
730
+ r"""Deletes a Cloud SQL instance.
731
+
732
+ .. code-block:: python
733
+
734
+ # This snippet has been automatically generated and should be regarded as a
735
+ # code template only.
736
+ # It will require modifications to work:
737
+ # - It may require correct/in-range values for request initialization.
738
+ # - It may require specifying regional endpoints when creating the service
739
+ # client as shown in:
740
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
741
+ from google.cloud import sqladmin_v1beta4
742
+
743
+ async def sample_delete():
744
+ # Create a client
745
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
746
+
747
+ # Initialize request argument(s)
748
+ request = sqladmin_v1beta4.SqlInstancesDeleteRequest(
749
+ final_backup_ttl_days=2210,
750
+ )
751
+
752
+ # Make the request
753
+ response = await client.delete(request=request)
754
+
755
+ # Handle the response
756
+ print(response)
757
+
758
+ Args:
759
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesDeleteRequest, dict]]):
760
+ The request object.
761
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
762
+ should be retried.
763
+ timeout (float): The timeout for this request.
764
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
765
+ sent along with the request as metadata. Normally, each value must be of type `str`,
766
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
767
+ be of type `bytes`.
768
+
769
+ Returns:
770
+ google.cloud.sqladmin_v1beta4.types.Operation:
771
+ An Operation resource. For
772
+ successful operations that return an
773
+ Operation resource, only the fields
774
+ relevant to the operation are populated
775
+ in the resource.
776
+
777
+ """
778
+ # Create or coerce a protobuf request object.
779
+ # - Use the request object if provided (there's no risk of modifying the input as
780
+ # there are no flattened fields), or create one.
781
+ if not isinstance(request, cloud_sql.SqlInstancesDeleteRequest):
782
+ request = cloud_sql.SqlInstancesDeleteRequest(request)
783
+
784
+ # Wrap the RPC method; this adds retry and timeout information,
785
+ # and friendly error handling.
786
+ rpc = self._client._transport._wrapped_methods[self._client._transport.delete]
787
+
788
+ # Certain fields should be provided within the metadata header;
789
+ # add these here.
790
+ metadata = tuple(metadata) + (
791
+ gapic_v1.routing_header.to_grpc_metadata(
792
+ (
793
+ ("project", request.project),
794
+ ("instance", request.instance),
795
+ )
796
+ ),
797
+ )
798
+
799
+ # Validate the universe domain.
800
+ self._client._validate_universe_domain()
801
+
802
+ # Send the request.
803
+ response = await rpc(
804
+ request,
805
+ retry=retry,
806
+ timeout=timeout,
807
+ metadata=metadata,
808
+ )
809
+
810
+ # Done; return the response.
811
+ return response
812
+
813
+ async def demote_master(
814
+ self,
815
+ request: Optional[
816
+ Union[cloud_sql.SqlInstancesDemoteMasterRequest, dict]
817
+ ] = None,
818
+ *,
819
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
820
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
821
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
822
+ ) -> cloud_sql_resources.Operation:
823
+ r"""Demotes the stand-alone instance to be a Cloud SQL
824
+ read replica for an external database server.
825
+
826
+ .. code-block:: python
827
+
828
+ # This snippet has been automatically generated and should be regarded as a
829
+ # code template only.
830
+ # It will require modifications to work:
831
+ # - It may require correct/in-range values for request initialization.
832
+ # - It may require specifying regional endpoints when creating the service
833
+ # client as shown in:
834
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
835
+ from google.cloud import sqladmin_v1beta4
836
+
837
+ async def sample_demote_master():
838
+ # Create a client
839
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
840
+
841
+ # Initialize request argument(s)
842
+ request = sqladmin_v1beta4.SqlInstancesDemoteMasterRequest(
843
+ )
844
+
845
+ # Make the request
846
+ response = await client.demote_master(request=request)
847
+
848
+ # Handle the response
849
+ print(response)
850
+
851
+ Args:
852
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesDemoteMasterRequest, dict]]):
853
+ The request object.
854
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
855
+ should be retried.
856
+ timeout (float): The timeout for this request.
857
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
858
+ sent along with the request as metadata. Normally, each value must be of type `str`,
859
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
860
+ be of type `bytes`.
861
+
862
+ Returns:
863
+ google.cloud.sqladmin_v1beta4.types.Operation:
864
+ An Operation resource. For
865
+ successful operations that return an
866
+ Operation resource, only the fields
867
+ relevant to the operation are populated
868
+ in the resource.
869
+
870
+ """
871
+ # Create or coerce a protobuf request object.
872
+ # - Use the request object if provided (there's no risk of modifying the input as
873
+ # there are no flattened fields), or create one.
874
+ if not isinstance(request, cloud_sql.SqlInstancesDemoteMasterRequest):
875
+ request = cloud_sql.SqlInstancesDemoteMasterRequest(request)
876
+
877
+ # Wrap the RPC method; this adds retry and timeout information,
878
+ # and friendly error handling.
879
+ rpc = self._client._transport._wrapped_methods[
880
+ self._client._transport.demote_master
881
+ ]
882
+
883
+ # Certain fields should be provided within the metadata header;
884
+ # add these here.
885
+ metadata = tuple(metadata) + (
886
+ gapic_v1.routing_header.to_grpc_metadata(
887
+ (
888
+ ("project", request.project),
889
+ ("instance", request.instance),
890
+ )
891
+ ),
892
+ )
893
+
894
+ # Validate the universe domain.
895
+ self._client._validate_universe_domain()
896
+
897
+ # Send the request.
898
+ response = await rpc(
899
+ request,
900
+ retry=retry,
901
+ timeout=timeout,
902
+ metadata=metadata,
903
+ )
904
+
905
+ # Done; return the response.
906
+ return response
907
+
908
+ async def demote(
909
+ self,
910
+ request: Optional[Union[cloud_sql.SqlInstancesDemoteRequest, dict]] = None,
911
+ *,
912
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
913
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
914
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
915
+ ) -> cloud_sql_resources.Operation:
916
+ r"""Demotes an existing standalone instance to be a Cloud
917
+ SQL read replica for an external database server.
918
+
919
+ .. code-block:: python
920
+
921
+ # This snippet has been automatically generated and should be regarded as a
922
+ # code template only.
923
+ # It will require modifications to work:
924
+ # - It may require correct/in-range values for request initialization.
925
+ # - It may require specifying regional endpoints when creating the service
926
+ # client as shown in:
927
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
928
+ from google.cloud import sqladmin_v1beta4
929
+
930
+ async def sample_demote():
931
+ # Create a client
932
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
933
+
934
+ # Initialize request argument(s)
935
+ request = sqladmin_v1beta4.SqlInstancesDemoteRequest(
936
+ instance="instance_value",
937
+ project="project_value",
938
+ )
939
+
940
+ # Make the request
941
+ response = await client.demote(request=request)
942
+
943
+ # Handle the response
944
+ print(response)
945
+
946
+ Args:
947
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesDemoteRequest, dict]]):
948
+ The request object. Instance demote request.
949
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
950
+ should be retried.
951
+ timeout (float): The timeout for this request.
952
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
953
+ sent along with the request as metadata. Normally, each value must be of type `str`,
954
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
955
+ be of type `bytes`.
956
+
957
+ Returns:
958
+ google.cloud.sqladmin_v1beta4.types.Operation:
959
+ An Operation resource. For
960
+ successful operations that return an
961
+ Operation resource, only the fields
962
+ relevant to the operation are populated
963
+ in the resource.
964
+
965
+ """
966
+ # Create or coerce a protobuf request object.
967
+ # - Use the request object if provided (there's no risk of modifying the input as
968
+ # there are no flattened fields), or create one.
969
+ if not isinstance(request, cloud_sql.SqlInstancesDemoteRequest):
970
+ request = cloud_sql.SqlInstancesDemoteRequest(request)
971
+
972
+ # Wrap the RPC method; this adds retry and timeout information,
973
+ # and friendly error handling.
974
+ rpc = self._client._transport._wrapped_methods[self._client._transport.demote]
975
+
976
+ # Certain fields should be provided within the metadata header;
977
+ # add these here.
978
+ metadata = tuple(metadata) + (
979
+ gapic_v1.routing_header.to_grpc_metadata(
980
+ (
981
+ ("project", request.project),
982
+ ("instance", request.instance),
983
+ )
984
+ ),
985
+ )
986
+
987
+ # Validate the universe domain.
988
+ self._client._validate_universe_domain()
989
+
990
+ # Send the request.
991
+ response = await rpc(
992
+ request,
993
+ retry=retry,
994
+ timeout=timeout,
995
+ metadata=metadata,
996
+ )
997
+
998
+ # Done; return the response.
999
+ return response
1000
+
1001
+ async def export(
1002
+ self,
1003
+ request: Optional[Union[cloud_sql.SqlInstancesExportRequest, dict]] = None,
1004
+ *,
1005
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1006
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1007
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1008
+ ) -> cloud_sql_resources.Operation:
1009
+ r"""Exports data from a Cloud SQL instance to a Cloud
1010
+ Storage bucket as a SQL dump or CSV file.
1011
+
1012
+ .. code-block:: python
1013
+
1014
+ # This snippet has been automatically generated and should be regarded as a
1015
+ # code template only.
1016
+ # It will require modifications to work:
1017
+ # - It may require correct/in-range values for request initialization.
1018
+ # - It may require specifying regional endpoints when creating the service
1019
+ # client as shown in:
1020
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1021
+ from google.cloud import sqladmin_v1beta4
1022
+
1023
+ async def sample_export():
1024
+ # Create a client
1025
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1026
+
1027
+ # Initialize request argument(s)
1028
+ request = sqladmin_v1beta4.SqlInstancesExportRequest(
1029
+ )
1030
+
1031
+ # Make the request
1032
+ response = await client.export(request=request)
1033
+
1034
+ # Handle the response
1035
+ print(response)
1036
+
1037
+ Args:
1038
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesExportRequest, dict]]):
1039
+ The request object.
1040
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1041
+ should be retried.
1042
+ timeout (float): The timeout for this request.
1043
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1044
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1045
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1046
+ be of type `bytes`.
1047
+
1048
+ Returns:
1049
+ google.cloud.sqladmin_v1beta4.types.Operation:
1050
+ An Operation resource. For
1051
+ successful operations that return an
1052
+ Operation resource, only the fields
1053
+ relevant to the operation are populated
1054
+ in the resource.
1055
+
1056
+ """
1057
+ # Create or coerce a protobuf request object.
1058
+ # - Use the request object if provided (there's no risk of modifying the input as
1059
+ # there are no flattened fields), or create one.
1060
+ if not isinstance(request, cloud_sql.SqlInstancesExportRequest):
1061
+ request = cloud_sql.SqlInstancesExportRequest(request)
1062
+
1063
+ # Wrap the RPC method; this adds retry and timeout information,
1064
+ # and friendly error handling.
1065
+ rpc = self._client._transport._wrapped_methods[self._client._transport.export]
1066
+
1067
+ # Certain fields should be provided within the metadata header;
1068
+ # add these here.
1069
+ metadata = tuple(metadata) + (
1070
+ gapic_v1.routing_header.to_grpc_metadata(
1071
+ (
1072
+ ("project", request.project),
1073
+ ("instance", request.instance),
1074
+ )
1075
+ ),
1076
+ )
1077
+
1078
+ # Validate the universe domain.
1079
+ self._client._validate_universe_domain()
1080
+
1081
+ # Send the request.
1082
+ response = await rpc(
1083
+ request,
1084
+ retry=retry,
1085
+ timeout=timeout,
1086
+ metadata=metadata,
1087
+ )
1088
+
1089
+ # Done; return the response.
1090
+ return response
1091
+
1092
+ async def failover(
1093
+ self,
1094
+ request: Optional[Union[cloud_sql.SqlInstancesFailoverRequest, dict]] = None,
1095
+ *,
1096
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1097
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1098
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1099
+ ) -> cloud_sql_resources.Operation:
1100
+ r"""Initiates a manual failover of a high availability (HA) primary
1101
+ instance to a standby instance, which becomes the primary
1102
+ instance. Users are then rerouted to the new primary. For more
1103
+ information, see the `Overview of high
1104
+ availability <https://cloud.google.com/sql/docs/mysql/high-availability>`__
1105
+ page in the Cloud SQL documentation. If using Legacy HA (MySQL
1106
+ only), this causes the instance to failover to its failover
1107
+ replica instance.
1108
+
1109
+ .. code-block:: python
1110
+
1111
+ # This snippet has been automatically generated and should be regarded as a
1112
+ # code template only.
1113
+ # It will require modifications to work:
1114
+ # - It may require correct/in-range values for request initialization.
1115
+ # - It may require specifying regional endpoints when creating the service
1116
+ # client as shown in:
1117
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1118
+ from google.cloud import sqladmin_v1beta4
1119
+
1120
+ async def sample_failover():
1121
+ # Create a client
1122
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1123
+
1124
+ # Initialize request argument(s)
1125
+ request = sqladmin_v1beta4.SqlInstancesFailoverRequest(
1126
+ )
1127
+
1128
+ # Make the request
1129
+ response = await client.failover(request=request)
1130
+
1131
+ # Handle the response
1132
+ print(response)
1133
+
1134
+ Args:
1135
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesFailoverRequest, dict]]):
1136
+ The request object.
1137
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1138
+ should be retried.
1139
+ timeout (float): The timeout for this request.
1140
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1141
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1142
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1143
+ be of type `bytes`.
1144
+
1145
+ Returns:
1146
+ google.cloud.sqladmin_v1beta4.types.Operation:
1147
+ An Operation resource.&nbsp;For
1148
+ successful operations that return an
1149
+ Operation resource, only the fields
1150
+ relevant to the operation are populated
1151
+ in the resource.
1152
+
1153
+ """
1154
+ # Create or coerce a protobuf request object.
1155
+ # - Use the request object if provided (there's no risk of modifying the input as
1156
+ # there are no flattened fields), or create one.
1157
+ if not isinstance(request, cloud_sql.SqlInstancesFailoverRequest):
1158
+ request = cloud_sql.SqlInstancesFailoverRequest(request)
1159
+
1160
+ # Wrap the RPC method; this adds retry and timeout information,
1161
+ # and friendly error handling.
1162
+ rpc = self._client._transport._wrapped_methods[self._client._transport.failover]
1163
+
1164
+ # Certain fields should be provided within the metadata header;
1165
+ # add these here.
1166
+ metadata = tuple(metadata) + (
1167
+ gapic_v1.routing_header.to_grpc_metadata(
1168
+ (
1169
+ ("project", request.project),
1170
+ ("instance", request.instance),
1171
+ )
1172
+ ),
1173
+ )
1174
+
1175
+ # Validate the universe domain.
1176
+ self._client._validate_universe_domain()
1177
+
1178
+ # Send the request.
1179
+ response = await rpc(
1180
+ request,
1181
+ retry=retry,
1182
+ timeout=timeout,
1183
+ metadata=metadata,
1184
+ )
1185
+
1186
+ # Done; return the response.
1187
+ return response
1188
+
1189
+ async def reencrypt(
1190
+ self,
1191
+ request: Optional[Union[cloud_sql.SqlInstancesReencryptRequest, dict]] = None,
1192
+ *,
1193
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1194
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1195
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1196
+ ) -> cloud_sql_resources.Operation:
1197
+ r"""Reencrypt CMEK instance with latest key version.
1198
+
1199
+ .. code-block:: python
1200
+
1201
+ # This snippet has been automatically generated and should be regarded as a
1202
+ # code template only.
1203
+ # It will require modifications to work:
1204
+ # - It may require correct/in-range values for request initialization.
1205
+ # - It may require specifying regional endpoints when creating the service
1206
+ # client as shown in:
1207
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1208
+ from google.cloud import sqladmin_v1beta4
1209
+
1210
+ async def sample_reencrypt():
1211
+ # Create a client
1212
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1213
+
1214
+ # Initialize request argument(s)
1215
+ request = sqladmin_v1beta4.SqlInstancesReencryptRequest(
1216
+ )
1217
+
1218
+ # Make the request
1219
+ response = await client.reencrypt(request=request)
1220
+
1221
+ # Handle the response
1222
+ print(response)
1223
+
1224
+ Args:
1225
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesReencryptRequest, dict]]):
1226
+ The request object. Instance reencrypt request.
1227
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1228
+ should be retried.
1229
+ timeout (float): The timeout for this request.
1230
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1231
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1232
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1233
+ be of type `bytes`.
1234
+
1235
+ Returns:
1236
+ google.cloud.sqladmin_v1beta4.types.Operation:
1237
+ An Operation resource.&nbsp;For
1238
+ successful operations that return an
1239
+ Operation resource, only the fields
1240
+ relevant to the operation are populated
1241
+ in the resource.
1242
+
1243
+ """
1244
+ # Create or coerce a protobuf request object.
1245
+ # - Use the request object if provided (there's no risk of modifying the input as
1246
+ # there are no flattened fields), or create one.
1247
+ if not isinstance(request, cloud_sql.SqlInstancesReencryptRequest):
1248
+ request = cloud_sql.SqlInstancesReencryptRequest(request)
1249
+
1250
+ # Wrap the RPC method; this adds retry and timeout information,
1251
+ # and friendly error handling.
1252
+ rpc = self._client._transport._wrapped_methods[
1253
+ self._client._transport.reencrypt
1254
+ ]
1255
+
1256
+ # Certain fields should be provided within the metadata header;
1257
+ # add these here.
1258
+ metadata = tuple(metadata) + (
1259
+ gapic_v1.routing_header.to_grpc_metadata(
1260
+ (
1261
+ ("project", request.project),
1262
+ ("instance", request.instance),
1263
+ )
1264
+ ),
1265
+ )
1266
+
1267
+ # Validate the universe domain.
1268
+ self._client._validate_universe_domain()
1269
+
1270
+ # Send the request.
1271
+ response = await rpc(
1272
+ request,
1273
+ retry=retry,
1274
+ timeout=timeout,
1275
+ metadata=metadata,
1276
+ )
1277
+
1278
+ # Done; return the response.
1279
+ return response
1280
+
1281
+ async def get(
1282
+ self,
1283
+ request: Optional[Union[cloud_sql.SqlInstancesGetRequest, dict]] = None,
1284
+ *,
1285
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1286
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1287
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1288
+ ) -> cloud_sql_resources.DatabaseInstance:
1289
+ r"""Retrieves a resource containing information about a
1290
+ Cloud SQL instance.
1291
+
1292
+ .. code-block:: python
1293
+
1294
+ # This snippet has been automatically generated and should be regarded as a
1295
+ # code template only.
1296
+ # It will require modifications to work:
1297
+ # - It may require correct/in-range values for request initialization.
1298
+ # - It may require specifying regional endpoints when creating the service
1299
+ # client as shown in:
1300
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1301
+ from google.cloud import sqladmin_v1beta4
1302
+
1303
+ async def sample_get():
1304
+ # Create a client
1305
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1306
+
1307
+ # Initialize request argument(s)
1308
+ request = sqladmin_v1beta4.SqlInstancesGetRequest(
1309
+ )
1310
+
1311
+ # Make the request
1312
+ response = await client.get(request=request)
1313
+
1314
+ # Handle the response
1315
+ print(response)
1316
+
1317
+ Args:
1318
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesGetRequest, dict]]):
1319
+ The request object.
1320
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1321
+ should be retried.
1322
+ timeout (float): The timeout for this request.
1323
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1324
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1325
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1326
+ be of type `bytes`.
1327
+
1328
+ Returns:
1329
+ google.cloud.sqladmin_v1beta4.types.DatabaseInstance:
1330
+ A Cloud SQL instance resource.
1331
+ """
1332
+ # Create or coerce a protobuf request object.
1333
+ # - Use the request object if provided (there's no risk of modifying the input as
1334
+ # there are no flattened fields), or create one.
1335
+ if not isinstance(request, cloud_sql.SqlInstancesGetRequest):
1336
+ request = cloud_sql.SqlInstancesGetRequest(request)
1337
+
1338
+ # Wrap the RPC method; this adds retry and timeout information,
1339
+ # and friendly error handling.
1340
+ rpc = self._client._transport._wrapped_methods[self._client._transport.get]
1341
+
1342
+ # Certain fields should be provided within the metadata header;
1343
+ # add these here.
1344
+ metadata = tuple(metadata) + (
1345
+ gapic_v1.routing_header.to_grpc_metadata(
1346
+ (
1347
+ ("project", request.project),
1348
+ ("instance", request.instance),
1349
+ )
1350
+ ),
1351
+ )
1352
+
1353
+ # Validate the universe domain.
1354
+ self._client._validate_universe_domain()
1355
+
1356
+ # Send the request.
1357
+ response = await rpc(
1358
+ request,
1359
+ retry=retry,
1360
+ timeout=timeout,
1361
+ metadata=metadata,
1362
+ )
1363
+
1364
+ # Done; return the response.
1365
+ return response
1366
+
1367
+ async def import_(
1368
+ self,
1369
+ request: Optional[Union[cloud_sql.SqlInstancesImportRequest, dict]] = None,
1370
+ *,
1371
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1372
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1373
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1374
+ ) -> cloud_sql_resources.Operation:
1375
+ r"""Imports data into a Cloud SQL instance from a SQL
1376
+ dump or CSV file in Cloud Storage.
1377
+
1378
+ .. code-block:: python
1379
+
1380
+ # This snippet has been automatically generated and should be regarded as a
1381
+ # code template only.
1382
+ # It will require modifications to work:
1383
+ # - It may require correct/in-range values for request initialization.
1384
+ # - It may require specifying regional endpoints when creating the service
1385
+ # client as shown in:
1386
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1387
+ from google.cloud import sqladmin_v1beta4
1388
+
1389
+ async def sample_import():
1390
+ # Create a client
1391
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1392
+
1393
+ # Initialize request argument(s)
1394
+ request = sqladmin_v1beta4.SqlInstancesImportRequest(
1395
+ )
1396
+
1397
+ # Make the request
1398
+ response = await client.import_(request=request)
1399
+
1400
+ # Handle the response
1401
+ print(response)
1402
+
1403
+ Args:
1404
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesImportRequest, dict]]):
1405
+ The request object.
1406
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1407
+ should be retried.
1408
+ timeout (float): The timeout for this request.
1409
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1410
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1411
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1412
+ be of type `bytes`.
1413
+
1414
+ Returns:
1415
+ google.cloud.sqladmin_v1beta4.types.Operation:
1416
+ An Operation resource.&nbsp;For
1417
+ successful operations that return an
1418
+ Operation resource, only the fields
1419
+ relevant to the operation are populated
1420
+ in the resource.
1421
+
1422
+ """
1423
+ # Create or coerce a protobuf request object.
1424
+ # - Use the request object if provided (there's no risk of modifying the input as
1425
+ # there are no flattened fields), or create one.
1426
+ if not isinstance(request, cloud_sql.SqlInstancesImportRequest):
1427
+ request = cloud_sql.SqlInstancesImportRequest(request)
1428
+
1429
+ # Wrap the RPC method; this adds retry and timeout information,
1430
+ # and friendly error handling.
1431
+ rpc = self._client._transport._wrapped_methods[self._client._transport.import_]
1432
+
1433
+ # Certain fields should be provided within the metadata header;
1434
+ # add these here.
1435
+ metadata = tuple(metadata) + (
1436
+ gapic_v1.routing_header.to_grpc_metadata(
1437
+ (
1438
+ ("project", request.project),
1439
+ ("instance", request.instance),
1440
+ )
1441
+ ),
1442
+ )
1443
+
1444
+ # Validate the universe domain.
1445
+ self._client._validate_universe_domain()
1446
+
1447
+ # Send the request.
1448
+ response = await rpc(
1449
+ request,
1450
+ retry=retry,
1451
+ timeout=timeout,
1452
+ metadata=metadata,
1453
+ )
1454
+
1455
+ # Done; return the response.
1456
+ return response
1457
+
1458
+ async def insert(
1459
+ self,
1460
+ request: Optional[Union[cloud_sql.SqlInstancesInsertRequest, dict]] = None,
1461
+ *,
1462
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1463
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1464
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1465
+ ) -> cloud_sql_resources.Operation:
1466
+ r"""Creates a new Cloud SQL instance.
1467
+
1468
+ .. code-block:: python
1469
+
1470
+ # This snippet has been automatically generated and should be regarded as a
1471
+ # code template only.
1472
+ # It will require modifications to work:
1473
+ # - It may require correct/in-range values for request initialization.
1474
+ # - It may require specifying regional endpoints when creating the service
1475
+ # client as shown in:
1476
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1477
+ from google.cloud import sqladmin_v1beta4
1478
+
1479
+ async def sample_insert():
1480
+ # Create a client
1481
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1482
+
1483
+ # Initialize request argument(s)
1484
+ request = sqladmin_v1beta4.SqlInstancesInsertRequest(
1485
+ )
1486
+
1487
+ # Make the request
1488
+ response = await client.insert(request=request)
1489
+
1490
+ # Handle the response
1491
+ print(response)
1492
+
1493
+ Args:
1494
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesInsertRequest, dict]]):
1495
+ The request object.
1496
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1497
+ should be retried.
1498
+ timeout (float): The timeout for this request.
1499
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1500
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1501
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1502
+ be of type `bytes`.
1503
+
1504
+ Returns:
1505
+ google.cloud.sqladmin_v1beta4.types.Operation:
1506
+ An Operation resource.&nbsp;For
1507
+ successful operations that return an
1508
+ Operation resource, only the fields
1509
+ relevant to the operation are populated
1510
+ in the resource.
1511
+
1512
+ """
1513
+ # Create or coerce a protobuf request object.
1514
+ # - Use the request object if provided (there's no risk of modifying the input as
1515
+ # there are no flattened fields), or create one.
1516
+ if not isinstance(request, cloud_sql.SqlInstancesInsertRequest):
1517
+ request = cloud_sql.SqlInstancesInsertRequest(request)
1518
+
1519
+ # Wrap the RPC method; this adds retry and timeout information,
1520
+ # and friendly error handling.
1521
+ rpc = self._client._transport._wrapped_methods[self._client._transport.insert]
1522
+
1523
+ # Certain fields should be provided within the metadata header;
1524
+ # add these here.
1525
+ metadata = tuple(metadata) + (
1526
+ gapic_v1.routing_header.to_grpc_metadata((("project", request.project),)),
1527
+ )
1528
+
1529
+ # Validate the universe domain.
1530
+ self._client._validate_universe_domain()
1531
+
1532
+ # Send the request.
1533
+ response = await rpc(
1534
+ request,
1535
+ retry=retry,
1536
+ timeout=timeout,
1537
+ metadata=metadata,
1538
+ )
1539
+
1540
+ # Done; return the response.
1541
+ return response
1542
+
1543
+ async def list(
1544
+ self,
1545
+ request: Optional[Union[cloud_sql.SqlInstancesListRequest, dict]] = None,
1546
+ *,
1547
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1548
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1549
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1550
+ ) -> pagers.ListAsyncPager:
1551
+ r"""Lists instances under a given project.
1552
+
1553
+ .. code-block:: python
1554
+
1555
+ # This snippet has been automatically generated and should be regarded as a
1556
+ # code template only.
1557
+ # It will require modifications to work:
1558
+ # - It may require correct/in-range values for request initialization.
1559
+ # - It may require specifying regional endpoints when creating the service
1560
+ # client as shown in:
1561
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1562
+ from google.cloud import sqladmin_v1beta4
1563
+
1564
+ async def sample_list():
1565
+ # Create a client
1566
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1567
+
1568
+ # Initialize request argument(s)
1569
+ request = sqladmin_v1beta4.SqlInstancesListRequest(
1570
+ )
1571
+
1572
+ # Make the request
1573
+ page_result = client.list(request=request)
1574
+
1575
+ # Handle the response
1576
+ async for response in page_result:
1577
+ print(response)
1578
+
1579
+ Args:
1580
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesListRequest, dict]]):
1581
+ The request object.
1582
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1583
+ should be retried.
1584
+ timeout (float): The timeout for this request.
1585
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1586
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1587
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1588
+ be of type `bytes`.
1589
+
1590
+ Returns:
1591
+ google.cloud.sqladmin_v1beta4.services.sql_instances_service.pagers.ListAsyncPager:
1592
+ Database instances list response.
1593
+
1594
+ Iterating over this object will yield
1595
+ results and resolve additional pages
1596
+ automatically.
1597
+
1598
+ """
1599
+ # Create or coerce a protobuf request object.
1600
+ # - Use the request object if provided (there's no risk of modifying the input as
1601
+ # there are no flattened fields), or create one.
1602
+ if not isinstance(request, cloud_sql.SqlInstancesListRequest):
1603
+ request = cloud_sql.SqlInstancesListRequest(request)
1604
+
1605
+ # Wrap the RPC method; this adds retry and timeout information,
1606
+ # and friendly error handling.
1607
+ rpc = self._client._transport._wrapped_methods[self._client._transport.list]
1608
+
1609
+ # Certain fields should be provided within the metadata header;
1610
+ # add these here.
1611
+ metadata = tuple(metadata) + (
1612
+ gapic_v1.routing_header.to_grpc_metadata((("project", request.project),)),
1613
+ )
1614
+
1615
+ # Validate the universe domain.
1616
+ self._client._validate_universe_domain()
1617
+
1618
+ # Send the request.
1619
+ response = await rpc(
1620
+ request,
1621
+ retry=retry,
1622
+ timeout=timeout,
1623
+ metadata=metadata,
1624
+ )
1625
+
1626
+ # This method is paged; wrap the response in a pager, which provides
1627
+ # an `__aiter__` convenience method.
1628
+ response = pagers.ListAsyncPager(
1629
+ method=rpc,
1630
+ request=request,
1631
+ response=response,
1632
+ retry=retry,
1633
+ timeout=timeout,
1634
+ metadata=metadata,
1635
+ )
1636
+
1637
+ # Done; return the response.
1638
+ return response
1639
+
1640
+ async def list_server_cas(
1641
+ self,
1642
+ request: Optional[
1643
+ Union[cloud_sql.SqlInstancesListServerCasRequest, dict]
1644
+ ] = None,
1645
+ *,
1646
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1647
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1648
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1649
+ ) -> cloud_sql_resources.InstancesListServerCasResponse:
1650
+ r"""Lists all of the trusted Certificate Authorities
1651
+ (CAs) for the specified instance. There can be up to
1652
+ three CAs listed: the CA that was used to sign the
1653
+ certificate that is currently in use, a CA that has been
1654
+ added but not yet used to sign a certificate, and a CA
1655
+ used to sign a certificate that has previously rotated
1656
+ out.
1657
+
1658
+ .. code-block:: python
1659
+
1660
+ # This snippet has been automatically generated and should be regarded as a
1661
+ # code template only.
1662
+ # It will require modifications to work:
1663
+ # - It may require correct/in-range values for request initialization.
1664
+ # - It may require specifying regional endpoints when creating the service
1665
+ # client as shown in:
1666
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1667
+ from google.cloud import sqladmin_v1beta4
1668
+
1669
+ async def sample_list_server_cas():
1670
+ # Create a client
1671
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1672
+
1673
+ # Initialize request argument(s)
1674
+ request = sqladmin_v1beta4.SqlInstancesListServerCasRequest(
1675
+ )
1676
+
1677
+ # Make the request
1678
+ response = await client.list_server_cas(request=request)
1679
+
1680
+ # Handle the response
1681
+ print(response)
1682
+
1683
+ Args:
1684
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesListServerCasRequest, dict]]):
1685
+ The request object.
1686
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1687
+ should be retried.
1688
+ timeout (float): The timeout for this request.
1689
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1690
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1691
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1692
+ be of type `bytes`.
1693
+
1694
+ Returns:
1695
+ google.cloud.sqladmin_v1beta4.types.InstancesListServerCasResponse:
1696
+ Instances ListServerCas response.
1697
+ """
1698
+ # Create or coerce a protobuf request object.
1699
+ # - Use the request object if provided (there's no risk of modifying the input as
1700
+ # there are no flattened fields), or create one.
1701
+ if not isinstance(request, cloud_sql.SqlInstancesListServerCasRequest):
1702
+ request = cloud_sql.SqlInstancesListServerCasRequest(request)
1703
+
1704
+ # Wrap the RPC method; this adds retry and timeout information,
1705
+ # and friendly error handling.
1706
+ rpc = self._client._transport._wrapped_methods[
1707
+ self._client._transport.list_server_cas
1708
+ ]
1709
+
1710
+ # Certain fields should be provided within the metadata header;
1711
+ # add these here.
1712
+ metadata = tuple(metadata) + (
1713
+ gapic_v1.routing_header.to_grpc_metadata(
1714
+ (
1715
+ ("project", request.project),
1716
+ ("instance", request.instance),
1717
+ )
1718
+ ),
1719
+ )
1720
+
1721
+ # Validate the universe domain.
1722
+ self._client._validate_universe_domain()
1723
+
1724
+ # Send the request.
1725
+ response = await rpc(
1726
+ request,
1727
+ retry=retry,
1728
+ timeout=timeout,
1729
+ metadata=metadata,
1730
+ )
1731
+
1732
+ # Done; return the response.
1733
+ return response
1734
+
1735
+ async def list_server_certificates(
1736
+ self,
1737
+ request: Optional[
1738
+ Union[cloud_sql.SqlInstancesListServerCertificatesRequest, dict]
1739
+ ] = None,
1740
+ *,
1741
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1742
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1743
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1744
+ ) -> cloud_sql_resources.InstancesListServerCertificatesResponse:
1745
+ r"""Lists all versions of server certificates and
1746
+ certificate authorities (CAs) for the specified
1747
+ instance. There can be up to three sets of certs listed:
1748
+
1749
+ the certificate that is currently in use, a future that
1750
+ has been added but not yet used to sign a certificate,
1751
+ and a certificate that has been rotated out. For
1752
+ instances not using Certificate Authority Service (CAS)
1753
+ server CA, use ListServerCas instead.
1754
+
1755
+ .. code-block:: python
1756
+
1757
+ # This snippet has been automatically generated and should be regarded as a
1758
+ # code template only.
1759
+ # It will require modifications to work:
1760
+ # - It may require correct/in-range values for request initialization.
1761
+ # - It may require specifying regional endpoints when creating the service
1762
+ # client as shown in:
1763
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1764
+ from google.cloud import sqladmin_v1beta4
1765
+
1766
+ async def sample_list_server_certificates():
1767
+ # Create a client
1768
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1769
+
1770
+ # Initialize request argument(s)
1771
+ request = sqladmin_v1beta4.SqlInstancesListServerCertificatesRequest(
1772
+ instance="instance_value",
1773
+ project="project_value",
1774
+ )
1775
+
1776
+ # Make the request
1777
+ response = await client.list_server_certificates(request=request)
1778
+
1779
+ # Handle the response
1780
+ print(response)
1781
+
1782
+ Args:
1783
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesListServerCertificatesRequest, dict]]):
1784
+ The request object.
1785
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1786
+ should be retried.
1787
+ timeout (float): The timeout for this request.
1788
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1789
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1790
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1791
+ be of type `bytes`.
1792
+
1793
+ Returns:
1794
+ google.cloud.sqladmin_v1beta4.types.InstancesListServerCertificatesResponse:
1795
+ Instances ListServerCertificatess
1796
+ response.
1797
+
1798
+ """
1799
+ # Create or coerce a protobuf request object.
1800
+ # - Use the request object if provided (there's no risk of modifying the input as
1801
+ # there are no flattened fields), or create one.
1802
+ if not isinstance(request, cloud_sql.SqlInstancesListServerCertificatesRequest):
1803
+ request = cloud_sql.SqlInstancesListServerCertificatesRequest(request)
1804
+
1805
+ # Wrap the RPC method; this adds retry and timeout information,
1806
+ # and friendly error handling.
1807
+ rpc = self._client._transport._wrapped_methods[
1808
+ self._client._transport.list_server_certificates
1809
+ ]
1810
+
1811
+ # Certain fields should be provided within the metadata header;
1812
+ # add these here.
1813
+ metadata = tuple(metadata) + (
1814
+ gapic_v1.routing_header.to_grpc_metadata(
1815
+ (
1816
+ ("project", request.project),
1817
+ ("instance", request.instance),
1818
+ )
1819
+ ),
1820
+ )
1821
+
1822
+ # Validate the universe domain.
1823
+ self._client._validate_universe_domain()
1824
+
1825
+ # Send the request.
1826
+ response = await rpc(
1827
+ request,
1828
+ retry=retry,
1829
+ timeout=timeout,
1830
+ metadata=metadata,
1831
+ )
1832
+
1833
+ # Done; return the response.
1834
+ return response
1835
+
1836
+ async def list_entra_id_certificates(
1837
+ self,
1838
+ request: Optional[
1839
+ Union[cloud_sql.SqlInstancesListEntraIdCertificatesRequest, dict]
1840
+ ] = None,
1841
+ *,
1842
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1843
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1844
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1845
+ ) -> cloud_sql_resources.InstancesListEntraIdCertificatesResponse:
1846
+ r"""Lists all versions of EntraID certificates for the
1847
+ specified instance. There can be up to three sets of
1848
+ certificates listed: the certificate that is currently
1849
+ in use, a future that has been added but not yet used to
1850
+ sign a certificate, and a certificate that has been
1851
+ rotated out.
1852
+
1853
+ .. code-block:: python
1854
+
1855
+ # This snippet has been automatically generated and should be regarded as a
1856
+ # code template only.
1857
+ # It will require modifications to work:
1858
+ # - It may require correct/in-range values for request initialization.
1859
+ # - It may require specifying regional endpoints when creating the service
1860
+ # client as shown in:
1861
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1862
+ from google.cloud import sqladmin_v1beta4
1863
+
1864
+ async def sample_list_entra_id_certificates():
1865
+ # Create a client
1866
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1867
+
1868
+ # Initialize request argument(s)
1869
+ request = sqladmin_v1beta4.SqlInstancesListEntraIdCertificatesRequest(
1870
+ instance="instance_value",
1871
+ project="project_value",
1872
+ )
1873
+
1874
+ # Make the request
1875
+ response = await client.list_entra_id_certificates(request=request)
1876
+
1877
+ # Handle the response
1878
+ print(response)
1879
+
1880
+ Args:
1881
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesListEntraIdCertificatesRequest, dict]]):
1882
+ The request object. Request message for
1883
+ SqlInstancesService.ListEntraIdCertificates.
1884
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1885
+ should be retried.
1886
+ timeout (float): The timeout for this request.
1887
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1888
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1889
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1890
+ be of type `bytes`.
1891
+
1892
+ Returns:
1893
+ google.cloud.sqladmin_v1beta4.types.InstancesListEntraIdCertificatesResponse:
1894
+ Instances ListEntraIdCertificates
1895
+ response.
1896
+
1897
+ """
1898
+ # Create or coerce a protobuf request object.
1899
+ # - Use the request object if provided (there's no risk of modifying the input as
1900
+ # there are no flattened fields), or create one.
1901
+ if not isinstance(
1902
+ request, cloud_sql.SqlInstancesListEntraIdCertificatesRequest
1903
+ ):
1904
+ request = cloud_sql.SqlInstancesListEntraIdCertificatesRequest(request)
1905
+
1906
+ # Wrap the RPC method; this adds retry and timeout information,
1907
+ # and friendly error handling.
1908
+ rpc = self._client._transport._wrapped_methods[
1909
+ self._client._transport.list_entra_id_certificates
1910
+ ]
1911
+
1912
+ # Certain fields should be provided within the metadata header;
1913
+ # add these here.
1914
+ metadata = tuple(metadata) + (
1915
+ gapic_v1.routing_header.to_grpc_metadata(
1916
+ (
1917
+ ("project", request.project),
1918
+ ("instance", request.instance),
1919
+ )
1920
+ ),
1921
+ )
1922
+
1923
+ # Validate the universe domain.
1924
+ self._client._validate_universe_domain()
1925
+
1926
+ # Send the request.
1927
+ response = await rpc(
1928
+ request,
1929
+ retry=retry,
1930
+ timeout=timeout,
1931
+ metadata=metadata,
1932
+ )
1933
+
1934
+ # Done; return the response.
1935
+ return response
1936
+
1937
+ async def patch(
1938
+ self,
1939
+ request: Optional[Union[cloud_sql.SqlInstancesPatchRequest, dict]] = None,
1940
+ *,
1941
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
1942
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1943
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
1944
+ ) -> cloud_sql_resources.Operation:
1945
+ r"""Partially updates settings of a Cloud SQL instance by
1946
+ merging the request with the current configuration. This
1947
+ method supports patch semantics.
1948
+
1949
+ .. code-block:: python
1950
+
1951
+ # This snippet has been automatically generated and should be regarded as a
1952
+ # code template only.
1953
+ # It will require modifications to work:
1954
+ # - It may require correct/in-range values for request initialization.
1955
+ # - It may require specifying regional endpoints when creating the service
1956
+ # client as shown in:
1957
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1958
+ from google.cloud import sqladmin_v1beta4
1959
+
1960
+ async def sample_patch():
1961
+ # Create a client
1962
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
1963
+
1964
+ # Initialize request argument(s)
1965
+ request = sqladmin_v1beta4.SqlInstancesPatchRequest(
1966
+ )
1967
+
1968
+ # Make the request
1969
+ response = await client.patch(request=request)
1970
+
1971
+ # Handle the response
1972
+ print(response)
1973
+
1974
+ Args:
1975
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesPatchRequest, dict]]):
1976
+ The request object.
1977
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1978
+ should be retried.
1979
+ timeout (float): The timeout for this request.
1980
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
1981
+ sent along with the request as metadata. Normally, each value must be of type `str`,
1982
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
1983
+ be of type `bytes`.
1984
+
1985
+ Returns:
1986
+ google.cloud.sqladmin_v1beta4.types.Operation:
1987
+ An Operation resource.&nbsp;For
1988
+ successful operations that return an
1989
+ Operation resource, only the fields
1990
+ relevant to the operation are populated
1991
+ in the resource.
1992
+
1993
+ """
1994
+ # Create or coerce a protobuf request object.
1995
+ # - Use the request object if provided (there's no risk of modifying the input as
1996
+ # there are no flattened fields), or create one.
1997
+ if not isinstance(request, cloud_sql.SqlInstancesPatchRequest):
1998
+ request = cloud_sql.SqlInstancesPatchRequest(request)
1999
+
2000
+ # Wrap the RPC method; this adds retry and timeout information,
2001
+ # and friendly error handling.
2002
+ rpc = self._client._transport._wrapped_methods[self._client._transport.patch]
2003
+
2004
+ # Certain fields should be provided within the metadata header;
2005
+ # add these here.
2006
+ metadata = tuple(metadata) + (
2007
+ gapic_v1.routing_header.to_grpc_metadata(
2008
+ (
2009
+ ("project", request.project),
2010
+ ("instance", request.instance),
2011
+ )
2012
+ ),
2013
+ )
2014
+
2015
+ # Validate the universe domain.
2016
+ self._client._validate_universe_domain()
2017
+
2018
+ # Send the request.
2019
+ response = await rpc(
2020
+ request,
2021
+ retry=retry,
2022
+ timeout=timeout,
2023
+ metadata=metadata,
2024
+ )
2025
+
2026
+ # Done; return the response.
2027
+ return response
2028
+
2029
+ async def promote_replica(
2030
+ self,
2031
+ request: Optional[
2032
+ Union[cloud_sql.SqlInstancesPromoteReplicaRequest, dict]
2033
+ ] = None,
2034
+ *,
2035
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2036
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2037
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2038
+ ) -> cloud_sql_resources.Operation:
2039
+ r"""Promotes the read replica instance to be an
2040
+ independent Cloud SQL primary instance.
2041
+ Using this operation might cause your instance to
2042
+ restart.
2043
+
2044
+ .. code-block:: python
2045
+
2046
+ # This snippet has been automatically generated and should be regarded as a
2047
+ # code template only.
2048
+ # It will require modifications to work:
2049
+ # - It may require correct/in-range values for request initialization.
2050
+ # - It may require specifying regional endpoints when creating the service
2051
+ # client as shown in:
2052
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2053
+ from google.cloud import sqladmin_v1beta4
2054
+
2055
+ async def sample_promote_replica():
2056
+ # Create a client
2057
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
2058
+
2059
+ # Initialize request argument(s)
2060
+ request = sqladmin_v1beta4.SqlInstancesPromoteReplicaRequest(
2061
+ )
2062
+
2063
+ # Make the request
2064
+ response = await client.promote_replica(request=request)
2065
+
2066
+ # Handle the response
2067
+ print(response)
2068
+
2069
+ Args:
2070
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesPromoteReplicaRequest, dict]]):
2071
+ The request object.
2072
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2073
+ should be retried.
2074
+ timeout (float): The timeout for this request.
2075
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2076
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2077
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2078
+ be of type `bytes`.
2079
+
2080
+ Returns:
2081
+ google.cloud.sqladmin_v1beta4.types.Operation:
2082
+ An Operation resource.&nbsp;For
2083
+ successful operations that return an
2084
+ Operation resource, only the fields
2085
+ relevant to the operation are populated
2086
+ in the resource.
2087
+
2088
+ """
2089
+ # Create or coerce a protobuf request object.
2090
+ # - Use the request object if provided (there's no risk of modifying the input as
2091
+ # there are no flattened fields), or create one.
2092
+ if not isinstance(request, cloud_sql.SqlInstancesPromoteReplicaRequest):
2093
+ request = cloud_sql.SqlInstancesPromoteReplicaRequest(request)
2094
+
2095
+ # Wrap the RPC method; this adds retry and timeout information,
2096
+ # and friendly error handling.
2097
+ rpc = self._client._transport._wrapped_methods[
2098
+ self._client._transport.promote_replica
2099
+ ]
2100
+
2101
+ # Certain fields should be provided within the metadata header;
2102
+ # add these here.
2103
+ metadata = tuple(metadata) + (
2104
+ gapic_v1.routing_header.to_grpc_metadata(
2105
+ (
2106
+ ("project", request.project),
2107
+ ("instance", request.instance),
2108
+ )
2109
+ ),
2110
+ )
2111
+
2112
+ # Validate the universe domain.
2113
+ self._client._validate_universe_domain()
2114
+
2115
+ # Send the request.
2116
+ response = await rpc(
2117
+ request,
2118
+ retry=retry,
2119
+ timeout=timeout,
2120
+ metadata=metadata,
2121
+ )
2122
+
2123
+ # Done; return the response.
2124
+ return response
2125
+
2126
+ async def switchover(
2127
+ self,
2128
+ request: Optional[Union[cloud_sql.SqlInstancesSwitchoverRequest, dict]] = None,
2129
+ *,
2130
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2131
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2132
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2133
+ ) -> cloud_sql_resources.Operation:
2134
+ r"""Switches over from the primary instance to the DR
2135
+ replica instance.
2136
+
2137
+ .. code-block:: python
2138
+
2139
+ # This snippet has been automatically generated and should be regarded as a
2140
+ # code template only.
2141
+ # It will require modifications to work:
2142
+ # - It may require correct/in-range values for request initialization.
2143
+ # - It may require specifying regional endpoints when creating the service
2144
+ # client as shown in:
2145
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2146
+ from google.cloud import sqladmin_v1beta4
2147
+
2148
+ async def sample_switchover():
2149
+ # Create a client
2150
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
2151
+
2152
+ # Initialize request argument(s)
2153
+ request = sqladmin_v1beta4.SqlInstancesSwitchoverRequest(
2154
+ )
2155
+
2156
+ # Make the request
2157
+ response = await client.switchover(request=request)
2158
+
2159
+ # Handle the response
2160
+ print(response)
2161
+
2162
+ Args:
2163
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesSwitchoverRequest, dict]]):
2164
+ The request object. Instance switchover request.
2165
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2166
+ should be retried.
2167
+ timeout (float): The timeout for this request.
2168
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2169
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2170
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2171
+ be of type `bytes`.
2172
+
2173
+ Returns:
2174
+ google.cloud.sqladmin_v1beta4.types.Operation:
2175
+ An Operation resource.&nbsp;For
2176
+ successful operations that return an
2177
+ Operation resource, only the fields
2178
+ relevant to the operation are populated
2179
+ in the resource.
2180
+
2181
+ """
2182
+ # Create or coerce a protobuf request object.
2183
+ # - Use the request object if provided (there's no risk of modifying the input as
2184
+ # there are no flattened fields), or create one.
2185
+ if not isinstance(request, cloud_sql.SqlInstancesSwitchoverRequest):
2186
+ request = cloud_sql.SqlInstancesSwitchoverRequest(request)
2187
+
2188
+ # Wrap the RPC method; this adds retry and timeout information,
2189
+ # and friendly error handling.
2190
+ rpc = self._client._transport._wrapped_methods[
2191
+ self._client._transport.switchover
2192
+ ]
2193
+
2194
+ # Certain fields should be provided within the metadata header;
2195
+ # add these here.
2196
+ metadata = tuple(metadata) + (
2197
+ gapic_v1.routing_header.to_grpc_metadata(
2198
+ (
2199
+ ("project", request.project),
2200
+ ("instance", request.instance),
2201
+ )
2202
+ ),
2203
+ )
2204
+
2205
+ # Validate the universe domain.
2206
+ self._client._validate_universe_domain()
2207
+
2208
+ # Send the request.
2209
+ response = await rpc(
2210
+ request,
2211
+ retry=retry,
2212
+ timeout=timeout,
2213
+ metadata=metadata,
2214
+ )
2215
+
2216
+ # Done; return the response.
2217
+ return response
2218
+
2219
+ async def reset_ssl_config(
2220
+ self,
2221
+ request: Optional[
2222
+ Union[cloud_sql.SqlInstancesResetSslConfigRequest, dict]
2223
+ ] = None,
2224
+ *,
2225
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2226
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2227
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2228
+ ) -> cloud_sql_resources.Operation:
2229
+ r"""Deletes all client certificates and generates a new
2230
+ server SSL certificate for the instance.
2231
+
2232
+ .. code-block:: python
2233
+
2234
+ # This snippet has been automatically generated and should be regarded as a
2235
+ # code template only.
2236
+ # It will require modifications to work:
2237
+ # - It may require correct/in-range values for request initialization.
2238
+ # - It may require specifying regional endpoints when creating the service
2239
+ # client as shown in:
2240
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2241
+ from google.cloud import sqladmin_v1beta4
2242
+
2243
+ async def sample_reset_ssl_config():
2244
+ # Create a client
2245
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
2246
+
2247
+ # Initialize request argument(s)
2248
+ request = sqladmin_v1beta4.SqlInstancesResetSslConfigRequest(
2249
+ )
2250
+
2251
+ # Make the request
2252
+ response = await client.reset_ssl_config(request=request)
2253
+
2254
+ # Handle the response
2255
+ print(response)
2256
+
2257
+ Args:
2258
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesResetSslConfigRequest, dict]]):
2259
+ The request object.
2260
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2261
+ should be retried.
2262
+ timeout (float): The timeout for this request.
2263
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2264
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2265
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2266
+ be of type `bytes`.
2267
+
2268
+ Returns:
2269
+ google.cloud.sqladmin_v1beta4.types.Operation:
2270
+ An Operation resource.&nbsp;For
2271
+ successful operations that return an
2272
+ Operation resource, only the fields
2273
+ relevant to the operation are populated
2274
+ in the resource.
2275
+
2276
+ """
2277
+ # Create or coerce a protobuf request object.
2278
+ # - Use the request object if provided (there's no risk of modifying the input as
2279
+ # there are no flattened fields), or create one.
2280
+ if not isinstance(request, cloud_sql.SqlInstancesResetSslConfigRequest):
2281
+ request = cloud_sql.SqlInstancesResetSslConfigRequest(request)
2282
+
2283
+ # Wrap the RPC method; this adds retry and timeout information,
2284
+ # and friendly error handling.
2285
+ rpc = self._client._transport._wrapped_methods[
2286
+ self._client._transport.reset_ssl_config
2287
+ ]
2288
+
2289
+ # Certain fields should be provided within the metadata header;
2290
+ # add these here.
2291
+ metadata = tuple(metadata) + (
2292
+ gapic_v1.routing_header.to_grpc_metadata(
2293
+ (
2294
+ ("project", request.project),
2295
+ ("instance", request.instance),
2296
+ )
2297
+ ),
2298
+ )
2299
+
2300
+ # Validate the universe domain.
2301
+ self._client._validate_universe_domain()
2302
+
2303
+ # Send the request.
2304
+ response = await rpc(
2305
+ request,
2306
+ retry=retry,
2307
+ timeout=timeout,
2308
+ metadata=metadata,
2309
+ )
2310
+
2311
+ # Done; return the response.
2312
+ return response
2313
+
2314
+ async def restart(
2315
+ self,
2316
+ request: Optional[Union[cloud_sql.SqlInstancesRestartRequest, dict]] = None,
2317
+ *,
2318
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2319
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2320
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2321
+ ) -> cloud_sql_resources.Operation:
2322
+ r"""Restarts a Cloud SQL instance.
2323
+
2324
+ .. code-block:: python
2325
+
2326
+ # This snippet has been automatically generated and should be regarded as a
2327
+ # code template only.
2328
+ # It will require modifications to work:
2329
+ # - It may require correct/in-range values for request initialization.
2330
+ # - It may require specifying regional endpoints when creating the service
2331
+ # client as shown in:
2332
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2333
+ from google.cloud import sqladmin_v1beta4
2334
+
2335
+ async def sample_restart():
2336
+ # Create a client
2337
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
2338
+
2339
+ # Initialize request argument(s)
2340
+ request = sqladmin_v1beta4.SqlInstancesRestartRequest(
2341
+ )
2342
+
2343
+ # Make the request
2344
+ response = await client.restart(request=request)
2345
+
2346
+ # Handle the response
2347
+ print(response)
2348
+
2349
+ Args:
2350
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesRestartRequest, dict]]):
2351
+ The request object.
2352
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2353
+ should be retried.
2354
+ timeout (float): The timeout for this request.
2355
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2356
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2357
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2358
+ be of type `bytes`.
2359
+
2360
+ Returns:
2361
+ google.cloud.sqladmin_v1beta4.types.Operation:
2362
+ An Operation resource.&nbsp;For
2363
+ successful operations that return an
2364
+ Operation resource, only the fields
2365
+ relevant to the operation are populated
2366
+ in the resource.
2367
+
2368
+ """
2369
+ # Create or coerce a protobuf request object.
2370
+ # - Use the request object if provided (there's no risk of modifying the input as
2371
+ # there are no flattened fields), or create one.
2372
+ if not isinstance(request, cloud_sql.SqlInstancesRestartRequest):
2373
+ request = cloud_sql.SqlInstancesRestartRequest(request)
2374
+
2375
+ # Wrap the RPC method; this adds retry and timeout information,
2376
+ # and friendly error handling.
2377
+ rpc = self._client._transport._wrapped_methods[self._client._transport.restart]
2378
+
2379
+ # Certain fields should be provided within the metadata header;
2380
+ # add these here.
2381
+ metadata = tuple(metadata) + (
2382
+ gapic_v1.routing_header.to_grpc_metadata(
2383
+ (
2384
+ ("project", request.project),
2385
+ ("instance", request.instance),
2386
+ )
2387
+ ),
2388
+ )
2389
+
2390
+ # Validate the universe domain.
2391
+ self._client._validate_universe_domain()
2392
+
2393
+ # Send the request.
2394
+ response = await rpc(
2395
+ request,
2396
+ retry=retry,
2397
+ timeout=timeout,
2398
+ metadata=metadata,
2399
+ )
2400
+
2401
+ # Done; return the response.
2402
+ return response
2403
+
2404
+ async def restore_backup(
2405
+ self,
2406
+ request: Optional[
2407
+ Union[cloud_sql.SqlInstancesRestoreBackupRequest, dict]
2408
+ ] = None,
2409
+ *,
2410
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2411
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2412
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2413
+ ) -> cloud_sql_resources.Operation:
2414
+ r"""Restores a backup of a Cloud SQL instance. Using this
2415
+ operation might cause your instance to restart.
2416
+
2417
+ .. code-block:: python
2418
+
2419
+ # This snippet has been automatically generated and should be regarded as a
2420
+ # code template only.
2421
+ # It will require modifications to work:
2422
+ # - It may require correct/in-range values for request initialization.
2423
+ # - It may require specifying regional endpoints when creating the service
2424
+ # client as shown in:
2425
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2426
+ from google.cloud import sqladmin_v1beta4
2427
+
2428
+ async def sample_restore_backup():
2429
+ # Create a client
2430
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
2431
+
2432
+ # Initialize request argument(s)
2433
+ request = sqladmin_v1beta4.SqlInstancesRestoreBackupRequest(
2434
+ )
2435
+
2436
+ # Make the request
2437
+ response = await client.restore_backup(request=request)
2438
+
2439
+ # Handle the response
2440
+ print(response)
2441
+
2442
+ Args:
2443
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesRestoreBackupRequest, dict]]):
2444
+ The request object.
2445
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2446
+ should be retried.
2447
+ timeout (float): The timeout for this request.
2448
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2449
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2450
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2451
+ be of type `bytes`.
2452
+
2453
+ Returns:
2454
+ google.cloud.sqladmin_v1beta4.types.Operation:
2455
+ An Operation resource.&nbsp;For
2456
+ successful operations that return an
2457
+ Operation resource, only the fields
2458
+ relevant to the operation are populated
2459
+ in the resource.
2460
+
2461
+ """
2462
+ # Create or coerce a protobuf request object.
2463
+ # - Use the request object if provided (there's no risk of modifying the input as
2464
+ # there are no flattened fields), or create one.
2465
+ if not isinstance(request, cloud_sql.SqlInstancesRestoreBackupRequest):
2466
+ request = cloud_sql.SqlInstancesRestoreBackupRequest(request)
2467
+
2468
+ # Wrap the RPC method; this adds retry and timeout information,
2469
+ # and friendly error handling.
2470
+ rpc = self._client._transport._wrapped_methods[
2471
+ self._client._transport.restore_backup
2472
+ ]
2473
+
2474
+ # Certain fields should be provided within the metadata header;
2475
+ # add these here.
2476
+ metadata = tuple(metadata) + (
2477
+ gapic_v1.routing_header.to_grpc_metadata(
2478
+ (
2479
+ ("project", request.project),
2480
+ ("instance", request.instance),
2481
+ )
2482
+ ),
2483
+ )
2484
+
2485
+ # Validate the universe domain.
2486
+ self._client._validate_universe_domain()
2487
+
2488
+ # Send the request.
2489
+ response = await rpc(
2490
+ request,
2491
+ retry=retry,
2492
+ timeout=timeout,
2493
+ metadata=metadata,
2494
+ )
2495
+
2496
+ # Done; return the response.
2497
+ return response
2498
+
2499
+ async def rotate_server_ca(
2500
+ self,
2501
+ request: Optional[
2502
+ Union[cloud_sql.SqlInstancesRotateServerCaRequest, dict]
2503
+ ] = None,
2504
+ *,
2505
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2506
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2507
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2508
+ ) -> cloud_sql_resources.Operation:
2509
+ r"""Rotates the server certificate to one signed by the
2510
+ Certificate Authority (CA) version previously added with
2511
+ the addServerCA method. For instances that have enabled
2512
+ Certificate Authority Service (CAS) based server CA, use
2513
+ RotateServerCertificate to rotate the server
2514
+ certificate.
2515
+
2516
+ .. code-block:: python
2517
+
2518
+ # This snippet has been automatically generated and should be regarded as a
2519
+ # code template only.
2520
+ # It will require modifications to work:
2521
+ # - It may require correct/in-range values for request initialization.
2522
+ # - It may require specifying regional endpoints when creating the service
2523
+ # client as shown in:
2524
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2525
+ from google.cloud import sqladmin_v1beta4
2526
+
2527
+ async def sample_rotate_server_ca():
2528
+ # Create a client
2529
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
2530
+
2531
+ # Initialize request argument(s)
2532
+ request = sqladmin_v1beta4.SqlInstancesRotateServerCaRequest(
2533
+ )
2534
+
2535
+ # Make the request
2536
+ response = await client.rotate_server_ca(request=request)
2537
+
2538
+ # Handle the response
2539
+ print(response)
2540
+
2541
+ Args:
2542
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesRotateServerCaRequest, dict]]):
2543
+ The request object.
2544
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2545
+ should be retried.
2546
+ timeout (float): The timeout for this request.
2547
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2548
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2549
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2550
+ be of type `bytes`.
2551
+
2552
+ Returns:
2553
+ google.cloud.sqladmin_v1beta4.types.Operation:
2554
+ An Operation resource.&nbsp;For
2555
+ successful operations that return an
2556
+ Operation resource, only the fields
2557
+ relevant to the operation are populated
2558
+ in the resource.
2559
+
2560
+ """
2561
+ # Create or coerce a protobuf request object.
2562
+ # - Use the request object if provided (there's no risk of modifying the input as
2563
+ # there are no flattened fields), or create one.
2564
+ if not isinstance(request, cloud_sql.SqlInstancesRotateServerCaRequest):
2565
+ request = cloud_sql.SqlInstancesRotateServerCaRequest(request)
2566
+
2567
+ # Wrap the RPC method; this adds retry and timeout information,
2568
+ # and friendly error handling.
2569
+ rpc = self._client._transport._wrapped_methods[
2570
+ self._client._transport.rotate_server_ca
2571
+ ]
2572
+
2573
+ # Certain fields should be provided within the metadata header;
2574
+ # add these here.
2575
+ metadata = tuple(metadata) + (
2576
+ gapic_v1.routing_header.to_grpc_metadata(
2577
+ (
2578
+ ("project", request.project),
2579
+ ("instance", request.instance),
2580
+ )
2581
+ ),
2582
+ )
2583
+
2584
+ # Validate the universe domain.
2585
+ self._client._validate_universe_domain()
2586
+
2587
+ # Send the request.
2588
+ response = await rpc(
2589
+ request,
2590
+ retry=retry,
2591
+ timeout=timeout,
2592
+ metadata=metadata,
2593
+ )
2594
+
2595
+ # Done; return the response.
2596
+ return response
2597
+
2598
+ async def rotate_server_certificate(
2599
+ self,
2600
+ request: Optional[
2601
+ Union[cloud_sql.SqlInstancesRotateServerCertificateRequest, dict]
2602
+ ] = None,
2603
+ *,
2604
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2605
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2606
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2607
+ ) -> cloud_sql_resources.Operation:
2608
+ r"""Rotates the server certificate version to one
2609
+ previously added with the addServerCertificate method.
2610
+ For instances not using Certificate Authority Service
2611
+ (CAS) server CA, use RotateServerCa instead.
2612
+
2613
+ .. code-block:: python
2614
+
2615
+ # This snippet has been automatically generated and should be regarded as a
2616
+ # code template only.
2617
+ # It will require modifications to work:
2618
+ # - It may require correct/in-range values for request initialization.
2619
+ # - It may require specifying regional endpoints when creating the service
2620
+ # client as shown in:
2621
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2622
+ from google.cloud import sqladmin_v1beta4
2623
+
2624
+ async def sample_rotate_server_certificate():
2625
+ # Create a client
2626
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
2627
+
2628
+ # Initialize request argument(s)
2629
+ request = sqladmin_v1beta4.SqlInstancesRotateServerCertificateRequest(
2630
+ instance="instance_value",
2631
+ project="project_value",
2632
+ )
2633
+
2634
+ # Make the request
2635
+ response = await client.rotate_server_certificate(request=request)
2636
+
2637
+ # Handle the response
2638
+ print(response)
2639
+
2640
+ Args:
2641
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesRotateServerCertificateRequest, dict]]):
2642
+ The request object.
2643
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2644
+ should be retried.
2645
+ timeout (float): The timeout for this request.
2646
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2647
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2648
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2649
+ be of type `bytes`.
2650
+
2651
+ Returns:
2652
+ google.cloud.sqladmin_v1beta4.types.Operation:
2653
+ An Operation resource.&nbsp;For
2654
+ successful operations that return an
2655
+ Operation resource, only the fields
2656
+ relevant to the operation are populated
2657
+ in the resource.
2658
+
2659
+ """
2660
+ # Create or coerce a protobuf request object.
2661
+ # - Use the request object if provided (there's no risk of modifying the input as
2662
+ # there are no flattened fields), or create one.
2663
+ if not isinstance(
2664
+ request, cloud_sql.SqlInstancesRotateServerCertificateRequest
2665
+ ):
2666
+ request = cloud_sql.SqlInstancesRotateServerCertificateRequest(request)
2667
+
2668
+ # Wrap the RPC method; this adds retry and timeout information,
2669
+ # and friendly error handling.
2670
+ rpc = self._client._transport._wrapped_methods[
2671
+ self._client._transport.rotate_server_certificate
2672
+ ]
2673
+
2674
+ # Certain fields should be provided within the metadata header;
2675
+ # add these here.
2676
+ metadata = tuple(metadata) + (
2677
+ gapic_v1.routing_header.to_grpc_metadata(
2678
+ (
2679
+ ("project", request.project),
2680
+ ("instance", request.instance),
2681
+ )
2682
+ ),
2683
+ )
2684
+
2685
+ # Validate the universe domain.
2686
+ self._client._validate_universe_domain()
2687
+
2688
+ # Send the request.
2689
+ response = await rpc(
2690
+ request,
2691
+ retry=retry,
2692
+ timeout=timeout,
2693
+ metadata=metadata,
2694
+ )
2695
+
2696
+ # Done; return the response.
2697
+ return response
2698
+
2699
+ async def rotate_entra_id_certificate(
2700
+ self,
2701
+ request: Optional[
2702
+ Union[cloud_sql.SqlInstancesRotateEntraIdCertificateRequest, dict]
2703
+ ] = None,
2704
+ *,
2705
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2706
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2707
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2708
+ ) -> cloud_sql_resources.Operation:
2709
+ r"""Rotates the Entra Id certificate version to one
2710
+ previously added with the addEntraIdCertificate method.
2711
+
2712
+ .. code-block:: python
2713
+
2714
+ # This snippet has been automatically generated and should be regarded as a
2715
+ # code template only.
2716
+ # It will require modifications to work:
2717
+ # - It may require correct/in-range values for request initialization.
2718
+ # - It may require specifying regional endpoints when creating the service
2719
+ # client as shown in:
2720
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2721
+ from google.cloud import sqladmin_v1beta4
2722
+
2723
+ async def sample_rotate_entra_id_certificate():
2724
+ # Create a client
2725
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
2726
+
2727
+ # Initialize request argument(s)
2728
+ request = sqladmin_v1beta4.SqlInstancesRotateEntraIdCertificateRequest(
2729
+ instance="instance_value",
2730
+ project="project_value",
2731
+ )
2732
+
2733
+ # Make the request
2734
+ response = await client.rotate_entra_id_certificate(request=request)
2735
+
2736
+ # Handle the response
2737
+ print(response)
2738
+
2739
+ Args:
2740
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesRotateEntraIdCertificateRequest, dict]]):
2741
+ The request object. Request message for
2742
+ SqlInstancesService.RotateEntraIdCertificate.
2743
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2744
+ should be retried.
2745
+ timeout (float): The timeout for this request.
2746
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2747
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2748
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2749
+ be of type `bytes`.
2750
+
2751
+ Returns:
2752
+ google.cloud.sqladmin_v1beta4.types.Operation:
2753
+ An Operation resource.&nbsp;For
2754
+ successful operations that return an
2755
+ Operation resource, only the fields
2756
+ relevant to the operation are populated
2757
+ in the resource.
2758
+
2759
+ """
2760
+ # Create or coerce a protobuf request object.
2761
+ # - Use the request object if provided (there's no risk of modifying the input as
2762
+ # there are no flattened fields), or create one.
2763
+ if not isinstance(
2764
+ request, cloud_sql.SqlInstancesRotateEntraIdCertificateRequest
2765
+ ):
2766
+ request = cloud_sql.SqlInstancesRotateEntraIdCertificateRequest(request)
2767
+
2768
+ # Wrap the RPC method; this adds retry and timeout information,
2769
+ # and friendly error handling.
2770
+ rpc = self._client._transport._wrapped_methods[
2771
+ self._client._transport.rotate_entra_id_certificate
2772
+ ]
2773
+
2774
+ # Certain fields should be provided within the metadata header;
2775
+ # add these here.
2776
+ metadata = tuple(metadata) + (
2777
+ gapic_v1.routing_header.to_grpc_metadata(
2778
+ (
2779
+ ("project", request.project),
2780
+ ("instance", request.instance),
2781
+ )
2782
+ ),
2783
+ )
2784
+
2785
+ # Validate the universe domain.
2786
+ self._client._validate_universe_domain()
2787
+
2788
+ # Send the request.
2789
+ response = await rpc(
2790
+ request,
2791
+ retry=retry,
2792
+ timeout=timeout,
2793
+ metadata=metadata,
2794
+ )
2795
+
2796
+ # Done; return the response.
2797
+ return response
2798
+
2799
+ async def start_replica(
2800
+ self,
2801
+ request: Optional[
2802
+ Union[cloud_sql.SqlInstancesStartReplicaRequest, dict]
2803
+ ] = None,
2804
+ *,
2805
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2806
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2807
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2808
+ ) -> cloud_sql_resources.Operation:
2809
+ r"""Starts the replication in the read replica instance.
2810
+
2811
+ .. code-block:: python
2812
+
2813
+ # This snippet has been automatically generated and should be regarded as a
2814
+ # code template only.
2815
+ # It will require modifications to work:
2816
+ # - It may require correct/in-range values for request initialization.
2817
+ # - It may require specifying regional endpoints when creating the service
2818
+ # client as shown in:
2819
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2820
+ from google.cloud import sqladmin_v1beta4
2821
+
2822
+ async def sample_start_replica():
2823
+ # Create a client
2824
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
2825
+
2826
+ # Initialize request argument(s)
2827
+ request = sqladmin_v1beta4.SqlInstancesStartReplicaRequest(
2828
+ )
2829
+
2830
+ # Make the request
2831
+ response = await client.start_replica(request=request)
2832
+
2833
+ # Handle the response
2834
+ print(response)
2835
+
2836
+ Args:
2837
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesStartReplicaRequest, dict]]):
2838
+ The request object.
2839
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2840
+ should be retried.
2841
+ timeout (float): The timeout for this request.
2842
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2843
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2844
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2845
+ be of type `bytes`.
2846
+
2847
+ Returns:
2848
+ google.cloud.sqladmin_v1beta4.types.Operation:
2849
+ An Operation resource.&nbsp;For
2850
+ successful operations that return an
2851
+ Operation resource, only the fields
2852
+ relevant to the operation are populated
2853
+ in the resource.
2854
+
2855
+ """
2856
+ # Create or coerce a protobuf request object.
2857
+ # - Use the request object if provided (there's no risk of modifying the input as
2858
+ # there are no flattened fields), or create one.
2859
+ if not isinstance(request, cloud_sql.SqlInstancesStartReplicaRequest):
2860
+ request = cloud_sql.SqlInstancesStartReplicaRequest(request)
2861
+
2862
+ # Wrap the RPC method; this adds retry and timeout information,
2863
+ # and friendly error handling.
2864
+ rpc = self._client._transport._wrapped_methods[
2865
+ self._client._transport.start_replica
2866
+ ]
2867
+
2868
+ # Certain fields should be provided within the metadata header;
2869
+ # add these here.
2870
+ metadata = tuple(metadata) + (
2871
+ gapic_v1.routing_header.to_grpc_metadata(
2872
+ (
2873
+ ("project", request.project),
2874
+ ("instance", request.instance),
2875
+ )
2876
+ ),
2877
+ )
2878
+
2879
+ # Validate the universe domain.
2880
+ self._client._validate_universe_domain()
2881
+
2882
+ # Send the request.
2883
+ response = await rpc(
2884
+ request,
2885
+ retry=retry,
2886
+ timeout=timeout,
2887
+ metadata=metadata,
2888
+ )
2889
+
2890
+ # Done; return the response.
2891
+ return response
2892
+
2893
+ async def stop_replica(
2894
+ self,
2895
+ request: Optional[Union[cloud_sql.SqlInstancesStopReplicaRequest, dict]] = None,
2896
+ *,
2897
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2898
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2899
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2900
+ ) -> cloud_sql_resources.Operation:
2901
+ r"""Stops the replication in the read replica instance.
2902
+
2903
+ .. code-block:: python
2904
+
2905
+ # This snippet has been automatically generated and should be regarded as a
2906
+ # code template only.
2907
+ # It will require modifications to work:
2908
+ # - It may require correct/in-range values for request initialization.
2909
+ # - It may require specifying regional endpoints when creating the service
2910
+ # client as shown in:
2911
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2912
+ from google.cloud import sqladmin_v1beta4
2913
+
2914
+ async def sample_stop_replica():
2915
+ # Create a client
2916
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
2917
+
2918
+ # Initialize request argument(s)
2919
+ request = sqladmin_v1beta4.SqlInstancesStopReplicaRequest(
2920
+ )
2921
+
2922
+ # Make the request
2923
+ response = await client.stop_replica(request=request)
2924
+
2925
+ # Handle the response
2926
+ print(response)
2927
+
2928
+ Args:
2929
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesStopReplicaRequest, dict]]):
2930
+ The request object.
2931
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2932
+ should be retried.
2933
+ timeout (float): The timeout for this request.
2934
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
2935
+ sent along with the request as metadata. Normally, each value must be of type `str`,
2936
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
2937
+ be of type `bytes`.
2938
+
2939
+ Returns:
2940
+ google.cloud.sqladmin_v1beta4.types.Operation:
2941
+ An Operation resource.&nbsp;For
2942
+ successful operations that return an
2943
+ Operation resource, only the fields
2944
+ relevant to the operation are populated
2945
+ in the resource.
2946
+
2947
+ """
2948
+ # Create or coerce a protobuf request object.
2949
+ # - Use the request object if provided (there's no risk of modifying the input as
2950
+ # there are no flattened fields), or create one.
2951
+ if not isinstance(request, cloud_sql.SqlInstancesStopReplicaRequest):
2952
+ request = cloud_sql.SqlInstancesStopReplicaRequest(request)
2953
+
2954
+ # Wrap the RPC method; this adds retry and timeout information,
2955
+ # and friendly error handling.
2956
+ rpc = self._client._transport._wrapped_methods[
2957
+ self._client._transport.stop_replica
2958
+ ]
2959
+
2960
+ # Certain fields should be provided within the metadata header;
2961
+ # add these here.
2962
+ metadata = tuple(metadata) + (
2963
+ gapic_v1.routing_header.to_grpc_metadata(
2964
+ (
2965
+ ("project", request.project),
2966
+ ("instance", request.instance),
2967
+ )
2968
+ ),
2969
+ )
2970
+
2971
+ # Validate the universe domain.
2972
+ self._client._validate_universe_domain()
2973
+
2974
+ # Send the request.
2975
+ response = await rpc(
2976
+ request,
2977
+ retry=retry,
2978
+ timeout=timeout,
2979
+ metadata=metadata,
2980
+ )
2981
+
2982
+ # Done; return the response.
2983
+ return response
2984
+
2985
+ async def truncate_log(
2986
+ self,
2987
+ request: Optional[Union[cloud_sql.SqlInstancesTruncateLogRequest, dict]] = None,
2988
+ *,
2989
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
2990
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2991
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
2992
+ ) -> cloud_sql_resources.Operation:
2993
+ r"""Truncate MySQL general and slow query log tables
2994
+ MySQL only.
2995
+
2996
+ .. code-block:: python
2997
+
2998
+ # This snippet has been automatically generated and should be regarded as a
2999
+ # code template only.
3000
+ # It will require modifications to work:
3001
+ # - It may require correct/in-range values for request initialization.
3002
+ # - It may require specifying regional endpoints when creating the service
3003
+ # client as shown in:
3004
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3005
+ from google.cloud import sqladmin_v1beta4
3006
+
3007
+ async def sample_truncate_log():
3008
+ # Create a client
3009
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3010
+
3011
+ # Initialize request argument(s)
3012
+ request = sqladmin_v1beta4.SqlInstancesTruncateLogRequest(
3013
+ )
3014
+
3015
+ # Make the request
3016
+ response = await client.truncate_log(request=request)
3017
+
3018
+ # Handle the response
3019
+ print(response)
3020
+
3021
+ Args:
3022
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesTruncateLogRequest, dict]]):
3023
+ The request object.
3024
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3025
+ should be retried.
3026
+ timeout (float): The timeout for this request.
3027
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3028
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3029
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3030
+ be of type `bytes`.
3031
+
3032
+ Returns:
3033
+ google.cloud.sqladmin_v1beta4.types.Operation:
3034
+ An Operation resource.&nbsp;For
3035
+ successful operations that return an
3036
+ Operation resource, only the fields
3037
+ relevant to the operation are populated
3038
+ in the resource.
3039
+
3040
+ """
3041
+ # Create or coerce a protobuf request object.
3042
+ # - Use the request object if provided (there's no risk of modifying the input as
3043
+ # there are no flattened fields), or create one.
3044
+ if not isinstance(request, cloud_sql.SqlInstancesTruncateLogRequest):
3045
+ request = cloud_sql.SqlInstancesTruncateLogRequest(request)
3046
+
3047
+ # Wrap the RPC method; this adds retry and timeout information,
3048
+ # and friendly error handling.
3049
+ rpc = self._client._transport._wrapped_methods[
3050
+ self._client._transport.truncate_log
3051
+ ]
3052
+
3053
+ # Certain fields should be provided within the metadata header;
3054
+ # add these here.
3055
+ metadata = tuple(metadata) + (
3056
+ gapic_v1.routing_header.to_grpc_metadata(
3057
+ (
3058
+ ("project", request.project),
3059
+ ("instance", request.instance),
3060
+ )
3061
+ ),
3062
+ )
3063
+
3064
+ # Validate the universe domain.
3065
+ self._client._validate_universe_domain()
3066
+
3067
+ # Send the request.
3068
+ response = await rpc(
3069
+ request,
3070
+ retry=retry,
3071
+ timeout=timeout,
3072
+ metadata=metadata,
3073
+ )
3074
+
3075
+ # Done; return the response.
3076
+ return response
3077
+
3078
+ async def update(
3079
+ self,
3080
+ request: Optional[Union[cloud_sql.SqlInstancesUpdateRequest, dict]] = None,
3081
+ *,
3082
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3083
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3084
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3085
+ ) -> cloud_sql_resources.Operation:
3086
+ r"""Updates settings of a Cloud SQL instance. Using this
3087
+ operation might cause your instance to restart.
3088
+
3089
+ .. code-block:: python
3090
+
3091
+ # This snippet has been automatically generated and should be regarded as a
3092
+ # code template only.
3093
+ # It will require modifications to work:
3094
+ # - It may require correct/in-range values for request initialization.
3095
+ # - It may require specifying regional endpoints when creating the service
3096
+ # client as shown in:
3097
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3098
+ from google.cloud import sqladmin_v1beta4
3099
+
3100
+ async def sample_update():
3101
+ # Create a client
3102
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3103
+
3104
+ # Initialize request argument(s)
3105
+ request = sqladmin_v1beta4.SqlInstancesUpdateRequest(
3106
+ )
3107
+
3108
+ # Make the request
3109
+ response = await client.update(request=request)
3110
+
3111
+ # Handle the response
3112
+ print(response)
3113
+
3114
+ Args:
3115
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesUpdateRequest, dict]]):
3116
+ The request object.
3117
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3118
+ should be retried.
3119
+ timeout (float): The timeout for this request.
3120
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3121
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3122
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3123
+ be of type `bytes`.
3124
+
3125
+ Returns:
3126
+ google.cloud.sqladmin_v1beta4.types.Operation:
3127
+ An Operation resource.&nbsp;For
3128
+ successful operations that return an
3129
+ Operation resource, only the fields
3130
+ relevant to the operation are populated
3131
+ in the resource.
3132
+
3133
+ """
3134
+ # Create or coerce a protobuf request object.
3135
+ # - Use the request object if provided (there's no risk of modifying the input as
3136
+ # there are no flattened fields), or create one.
3137
+ if not isinstance(request, cloud_sql.SqlInstancesUpdateRequest):
3138
+ request = cloud_sql.SqlInstancesUpdateRequest(request)
3139
+
3140
+ # Wrap the RPC method; this adds retry and timeout information,
3141
+ # and friendly error handling.
3142
+ rpc = self._client._transport._wrapped_methods[self._client._transport.update]
3143
+
3144
+ # Certain fields should be provided within the metadata header;
3145
+ # add these here.
3146
+ metadata = tuple(metadata) + (
3147
+ gapic_v1.routing_header.to_grpc_metadata(
3148
+ (
3149
+ ("project", request.project),
3150
+ ("instance", request.instance),
3151
+ )
3152
+ ),
3153
+ )
3154
+
3155
+ # Validate the universe domain.
3156
+ self._client._validate_universe_domain()
3157
+
3158
+ # Send the request.
3159
+ response = await rpc(
3160
+ request,
3161
+ retry=retry,
3162
+ timeout=timeout,
3163
+ metadata=metadata,
3164
+ )
3165
+
3166
+ # Done; return the response.
3167
+ return response
3168
+
3169
+ async def create_ephemeral(
3170
+ self,
3171
+ request: Optional[
3172
+ Union[cloud_sql.SqlInstancesCreateEphemeralCertRequest, dict]
3173
+ ] = None,
3174
+ *,
3175
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3176
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3177
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3178
+ ) -> cloud_sql_resources.SslCert:
3179
+ r"""Generates a short-lived X509 certificate containing
3180
+ the provided public key and signed by a private key
3181
+ specific to the target instance. Users may use the
3182
+ certificate to authenticate as themselves when
3183
+ connecting to the database.
3184
+
3185
+ .. code-block:: python
3186
+
3187
+ # This snippet has been automatically generated and should be regarded as a
3188
+ # code template only.
3189
+ # It will require modifications to work:
3190
+ # - It may require correct/in-range values for request initialization.
3191
+ # - It may require specifying regional endpoints when creating the service
3192
+ # client as shown in:
3193
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3194
+ from google.cloud import sqladmin_v1beta4
3195
+
3196
+ async def sample_create_ephemeral():
3197
+ # Create a client
3198
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3199
+
3200
+ # Initialize request argument(s)
3201
+ request = sqladmin_v1beta4.SqlInstancesCreateEphemeralCertRequest(
3202
+ )
3203
+
3204
+ # Make the request
3205
+ response = await client.create_ephemeral(request=request)
3206
+
3207
+ # Handle the response
3208
+ print(response)
3209
+
3210
+ Args:
3211
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesCreateEphemeralCertRequest, dict]]):
3212
+ The request object.
3213
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3214
+ should be retried.
3215
+ timeout (float): The timeout for this request.
3216
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3217
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3218
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3219
+ be of type `bytes`.
3220
+
3221
+ Returns:
3222
+ google.cloud.sqladmin_v1beta4.types.SslCert:
3223
+ SslCerts Resource
3224
+ """
3225
+ # Create or coerce a protobuf request object.
3226
+ # - Use the request object if provided (there's no risk of modifying the input as
3227
+ # there are no flattened fields), or create one.
3228
+ if not isinstance(request, cloud_sql.SqlInstancesCreateEphemeralCertRequest):
3229
+ request = cloud_sql.SqlInstancesCreateEphemeralCertRequest(request)
3230
+
3231
+ # Wrap the RPC method; this adds retry and timeout information,
3232
+ # and friendly error handling.
3233
+ rpc = self._client._transport._wrapped_methods[
3234
+ self._client._transport.create_ephemeral
3235
+ ]
3236
+
3237
+ # Certain fields should be provided within the metadata header;
3238
+ # add these here.
3239
+ metadata = tuple(metadata) + (
3240
+ gapic_v1.routing_header.to_grpc_metadata(
3241
+ (
3242
+ ("project", request.project),
3243
+ ("instance", request.instance),
3244
+ )
3245
+ ),
3246
+ )
3247
+
3248
+ # Validate the universe domain.
3249
+ self._client._validate_universe_domain()
3250
+
3251
+ # Send the request.
3252
+ response = await rpc(
3253
+ request,
3254
+ retry=retry,
3255
+ timeout=timeout,
3256
+ metadata=metadata,
3257
+ )
3258
+
3259
+ # Done; return the response.
3260
+ return response
3261
+
3262
+ async def reschedule_maintenance(
3263
+ self,
3264
+ request: Optional[
3265
+ Union[cloud_sql.SqlInstancesRescheduleMaintenanceRequest, dict]
3266
+ ] = None,
3267
+ *,
3268
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3269
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3270
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3271
+ ) -> cloud_sql_resources.Operation:
3272
+ r"""Reschedules the maintenance on the given instance.
3273
+
3274
+ .. code-block:: python
3275
+
3276
+ # This snippet has been automatically generated and should be regarded as a
3277
+ # code template only.
3278
+ # It will require modifications to work:
3279
+ # - It may require correct/in-range values for request initialization.
3280
+ # - It may require specifying regional endpoints when creating the service
3281
+ # client as shown in:
3282
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3283
+ from google.cloud import sqladmin_v1beta4
3284
+
3285
+ async def sample_reschedule_maintenance():
3286
+ # Create a client
3287
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3288
+
3289
+ # Initialize request argument(s)
3290
+ request = sqladmin_v1beta4.SqlInstancesRescheduleMaintenanceRequest(
3291
+ )
3292
+
3293
+ # Make the request
3294
+ response = await client.reschedule_maintenance(request=request)
3295
+
3296
+ # Handle the response
3297
+ print(response)
3298
+
3299
+ Args:
3300
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesRescheduleMaintenanceRequest, dict]]):
3301
+ The request object.
3302
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3303
+ should be retried.
3304
+ timeout (float): The timeout for this request.
3305
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3306
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3307
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3308
+ be of type `bytes`.
3309
+
3310
+ Returns:
3311
+ google.cloud.sqladmin_v1beta4.types.Operation:
3312
+ An Operation resource.&nbsp;For
3313
+ successful operations that return an
3314
+ Operation resource, only the fields
3315
+ relevant to the operation are populated
3316
+ in the resource.
3317
+
3318
+ """
3319
+ # Create or coerce a protobuf request object.
3320
+ # - Use the request object if provided (there's no risk of modifying the input as
3321
+ # there are no flattened fields), or create one.
3322
+ if not isinstance(request, cloud_sql.SqlInstancesRescheduleMaintenanceRequest):
3323
+ request = cloud_sql.SqlInstancesRescheduleMaintenanceRequest(request)
3324
+
3325
+ # Wrap the RPC method; this adds retry and timeout information,
3326
+ # and friendly error handling.
3327
+ rpc = self._client._transport._wrapped_methods[
3328
+ self._client._transport.reschedule_maintenance
3329
+ ]
3330
+
3331
+ # Certain fields should be provided within the metadata header;
3332
+ # add these here.
3333
+ metadata = tuple(metadata) + (
3334
+ gapic_v1.routing_header.to_grpc_metadata(
3335
+ (
3336
+ ("project", request.project),
3337
+ ("instance", request.instance),
3338
+ )
3339
+ ),
3340
+ )
3341
+
3342
+ # Validate the universe domain.
3343
+ self._client._validate_universe_domain()
3344
+
3345
+ # Send the request.
3346
+ response = await rpc(
3347
+ request,
3348
+ retry=retry,
3349
+ timeout=timeout,
3350
+ metadata=metadata,
3351
+ )
3352
+
3353
+ # Done; return the response.
3354
+ return response
3355
+
3356
+ async def verify_external_sync_settings(
3357
+ self,
3358
+ request: Optional[
3359
+ Union[cloud_sql.SqlInstancesVerifyExternalSyncSettingsRequest, dict]
3360
+ ] = None,
3361
+ *,
3362
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3363
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3364
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3365
+ ) -> cloud_sql_resources.SqlInstancesVerifyExternalSyncSettingsResponse:
3366
+ r"""Verify External primary instance external sync
3367
+ settings.
3368
+
3369
+ .. code-block:: python
3370
+
3371
+ # This snippet has been automatically generated and should be regarded as a
3372
+ # code template only.
3373
+ # It will require modifications to work:
3374
+ # - It may require correct/in-range values for request initialization.
3375
+ # - It may require specifying regional endpoints when creating the service
3376
+ # client as shown in:
3377
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3378
+ from google.cloud import sqladmin_v1beta4
3379
+
3380
+ async def sample_verify_external_sync_settings():
3381
+ # Create a client
3382
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3383
+
3384
+ # Initialize request argument(s)
3385
+ request = sqladmin_v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(
3386
+ )
3387
+
3388
+ # Make the request
3389
+ response = await client.verify_external_sync_settings(request=request)
3390
+
3391
+ # Handle the response
3392
+ print(response)
3393
+
3394
+ Args:
3395
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesVerifyExternalSyncSettingsRequest, dict]]):
3396
+ The request object.
3397
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3398
+ should be retried.
3399
+ timeout (float): The timeout for this request.
3400
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3401
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3402
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3403
+ be of type `bytes`.
3404
+
3405
+ Returns:
3406
+ google.cloud.sqladmin_v1beta4.types.SqlInstancesVerifyExternalSyncSettingsResponse:
3407
+ Instance verify external sync
3408
+ settings response.
3409
+
3410
+ """
3411
+ # Create or coerce a protobuf request object.
3412
+ # - Use the request object if provided (there's no risk of modifying the input as
3413
+ # there are no flattened fields), or create one.
3414
+ if not isinstance(
3415
+ request, cloud_sql.SqlInstancesVerifyExternalSyncSettingsRequest
3416
+ ):
3417
+ request = cloud_sql.SqlInstancesVerifyExternalSyncSettingsRequest(request)
3418
+
3419
+ # Wrap the RPC method; this adds retry and timeout information,
3420
+ # and friendly error handling.
3421
+ rpc = self._client._transport._wrapped_methods[
3422
+ self._client._transport.verify_external_sync_settings
3423
+ ]
3424
+
3425
+ # Certain fields should be provided within the metadata header;
3426
+ # add these here.
3427
+ metadata = tuple(metadata) + (
3428
+ gapic_v1.routing_header.to_grpc_metadata(
3429
+ (
3430
+ ("project", request.project),
3431
+ ("instance", request.instance),
3432
+ )
3433
+ ),
3434
+ )
3435
+
3436
+ # Validate the universe domain.
3437
+ self._client._validate_universe_domain()
3438
+
3439
+ # Send the request.
3440
+ response = await rpc(
3441
+ request,
3442
+ retry=retry,
3443
+ timeout=timeout,
3444
+ metadata=metadata,
3445
+ )
3446
+
3447
+ # Done; return the response.
3448
+ return response
3449
+
3450
+ async def start_external_sync(
3451
+ self,
3452
+ request: Optional[
3453
+ Union[cloud_sql.SqlInstancesStartExternalSyncRequest, dict]
3454
+ ] = None,
3455
+ *,
3456
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3457
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3458
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3459
+ ) -> cloud_sql_resources.Operation:
3460
+ r"""Start External primary instance migration.
3461
+
3462
+ .. code-block:: python
3463
+
3464
+ # This snippet has been automatically generated and should be regarded as a
3465
+ # code template only.
3466
+ # It will require modifications to work:
3467
+ # - It may require correct/in-range values for request initialization.
3468
+ # - It may require specifying regional endpoints when creating the service
3469
+ # client as shown in:
3470
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3471
+ from google.cloud import sqladmin_v1beta4
3472
+
3473
+ async def sample_start_external_sync():
3474
+ # Create a client
3475
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3476
+
3477
+ # Initialize request argument(s)
3478
+ request = sqladmin_v1beta4.SqlInstancesStartExternalSyncRequest(
3479
+ )
3480
+
3481
+ # Make the request
3482
+ response = await client.start_external_sync(request=request)
3483
+
3484
+ # Handle the response
3485
+ print(response)
3486
+
3487
+ Args:
3488
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesStartExternalSyncRequest, dict]]):
3489
+ The request object.
3490
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3491
+ should be retried.
3492
+ timeout (float): The timeout for this request.
3493
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3494
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3495
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3496
+ be of type `bytes`.
3497
+
3498
+ Returns:
3499
+ google.cloud.sqladmin_v1beta4.types.Operation:
3500
+ An Operation resource.&nbsp;For
3501
+ successful operations that return an
3502
+ Operation resource, only the fields
3503
+ relevant to the operation are populated
3504
+ in the resource.
3505
+
3506
+ """
3507
+ # Create or coerce a protobuf request object.
3508
+ # - Use the request object if provided (there's no risk of modifying the input as
3509
+ # there are no flattened fields), or create one.
3510
+ if not isinstance(request, cloud_sql.SqlInstancesStartExternalSyncRequest):
3511
+ request = cloud_sql.SqlInstancesStartExternalSyncRequest(request)
3512
+
3513
+ # Wrap the RPC method; this adds retry and timeout information,
3514
+ # and friendly error handling.
3515
+ rpc = self._client._transport._wrapped_methods[
3516
+ self._client._transport.start_external_sync
3517
+ ]
3518
+
3519
+ # Certain fields should be provided within the metadata header;
3520
+ # add these here.
3521
+ metadata = tuple(metadata) + (
3522
+ gapic_v1.routing_header.to_grpc_metadata(
3523
+ (
3524
+ ("project", request.project),
3525
+ ("instance", request.instance),
3526
+ )
3527
+ ),
3528
+ )
3529
+
3530
+ # Validate the universe domain.
3531
+ self._client._validate_universe_domain()
3532
+
3533
+ # Send the request.
3534
+ response = await rpc(
3535
+ request,
3536
+ retry=retry,
3537
+ timeout=timeout,
3538
+ metadata=metadata,
3539
+ )
3540
+
3541
+ # Done; return the response.
3542
+ return response
3543
+
3544
+ async def perform_disk_shrink(
3545
+ self,
3546
+ request: Optional[
3547
+ Union[cloud_sql.SqlInstancesPerformDiskShrinkRequest, dict]
3548
+ ] = None,
3549
+ *,
3550
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3551
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3552
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3553
+ ) -> cloud_sql_resources.Operation:
3554
+ r"""Perform Disk Shrink on primary instance.
3555
+
3556
+ .. code-block:: python
3557
+
3558
+ # This snippet has been automatically generated and should be regarded as a
3559
+ # code template only.
3560
+ # It will require modifications to work:
3561
+ # - It may require correct/in-range values for request initialization.
3562
+ # - It may require specifying regional endpoints when creating the service
3563
+ # client as shown in:
3564
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3565
+ from google.cloud import sqladmin_v1beta4
3566
+
3567
+ async def sample_perform_disk_shrink():
3568
+ # Create a client
3569
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3570
+
3571
+ # Initialize request argument(s)
3572
+ request = sqladmin_v1beta4.SqlInstancesPerformDiskShrinkRequest(
3573
+ )
3574
+
3575
+ # Make the request
3576
+ response = await client.perform_disk_shrink(request=request)
3577
+
3578
+ # Handle the response
3579
+ print(response)
3580
+
3581
+ Args:
3582
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesPerformDiskShrinkRequest, dict]]):
3583
+ The request object. Instance perform disk shrink request.
3584
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3585
+ should be retried.
3586
+ timeout (float): The timeout for this request.
3587
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3588
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3589
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3590
+ be of type `bytes`.
3591
+
3592
+ Returns:
3593
+ google.cloud.sqladmin_v1beta4.types.Operation:
3594
+ An Operation resource.&nbsp;For
3595
+ successful operations that return an
3596
+ Operation resource, only the fields
3597
+ relevant to the operation are populated
3598
+ in the resource.
3599
+
3600
+ """
3601
+ # Create or coerce a protobuf request object.
3602
+ # - Use the request object if provided (there's no risk of modifying the input as
3603
+ # there are no flattened fields), or create one.
3604
+ if not isinstance(request, cloud_sql.SqlInstancesPerformDiskShrinkRequest):
3605
+ request = cloud_sql.SqlInstancesPerformDiskShrinkRequest(request)
3606
+
3607
+ # Wrap the RPC method; this adds retry and timeout information,
3608
+ # and friendly error handling.
3609
+ rpc = self._client._transport._wrapped_methods[
3610
+ self._client._transport.perform_disk_shrink
3611
+ ]
3612
+
3613
+ # Certain fields should be provided within the metadata header;
3614
+ # add these here.
3615
+ metadata = tuple(metadata) + (
3616
+ gapic_v1.routing_header.to_grpc_metadata(
3617
+ (
3618
+ ("project", request.project),
3619
+ ("instance", request.instance),
3620
+ )
3621
+ ),
3622
+ )
3623
+
3624
+ # Validate the universe domain.
3625
+ self._client._validate_universe_domain()
3626
+
3627
+ # Send the request.
3628
+ response = await rpc(
3629
+ request,
3630
+ retry=retry,
3631
+ timeout=timeout,
3632
+ metadata=metadata,
3633
+ )
3634
+
3635
+ # Done; return the response.
3636
+ return response
3637
+
3638
+ async def get_disk_shrink_config(
3639
+ self,
3640
+ request: Optional[
3641
+ Union[cloud_sql.SqlInstancesGetDiskShrinkConfigRequest, dict]
3642
+ ] = None,
3643
+ *,
3644
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3645
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3646
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3647
+ ) -> cloud_sql_resources.SqlInstancesGetDiskShrinkConfigResponse:
3648
+ r"""Get Disk Shrink Config for a given instance.
3649
+
3650
+ .. code-block:: python
3651
+
3652
+ # This snippet has been automatically generated and should be regarded as a
3653
+ # code template only.
3654
+ # It will require modifications to work:
3655
+ # - It may require correct/in-range values for request initialization.
3656
+ # - It may require specifying regional endpoints when creating the service
3657
+ # client as shown in:
3658
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3659
+ from google.cloud import sqladmin_v1beta4
3660
+
3661
+ async def sample_get_disk_shrink_config():
3662
+ # Create a client
3663
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3664
+
3665
+ # Initialize request argument(s)
3666
+ request = sqladmin_v1beta4.SqlInstancesGetDiskShrinkConfigRequest(
3667
+ )
3668
+
3669
+ # Make the request
3670
+ response = await client.get_disk_shrink_config(request=request)
3671
+
3672
+ # Handle the response
3673
+ print(response)
3674
+
3675
+ Args:
3676
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesGetDiskShrinkConfigRequest, dict]]):
3677
+ The request object. Instance get disk shrink config
3678
+ request.
3679
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3680
+ should be retried.
3681
+ timeout (float): The timeout for this request.
3682
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3683
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3684
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3685
+ be of type `bytes`.
3686
+
3687
+ Returns:
3688
+ google.cloud.sqladmin_v1beta4.types.SqlInstancesGetDiskShrinkConfigResponse:
3689
+ Instance get disk shrink config
3690
+ response.
3691
+
3692
+ """
3693
+ # Create or coerce a protobuf request object.
3694
+ # - Use the request object if provided (there's no risk of modifying the input as
3695
+ # there are no flattened fields), or create one.
3696
+ if not isinstance(request, cloud_sql.SqlInstancesGetDiskShrinkConfigRequest):
3697
+ request = cloud_sql.SqlInstancesGetDiskShrinkConfigRequest(request)
3698
+
3699
+ # Wrap the RPC method; this adds retry and timeout information,
3700
+ # and friendly error handling.
3701
+ rpc = self._client._transport._wrapped_methods[
3702
+ self._client._transport.get_disk_shrink_config
3703
+ ]
3704
+
3705
+ # Certain fields should be provided within the metadata header;
3706
+ # add these here.
3707
+ metadata = tuple(metadata) + (
3708
+ gapic_v1.routing_header.to_grpc_metadata(
3709
+ (
3710
+ ("project", request.project),
3711
+ ("instance", request.instance),
3712
+ )
3713
+ ),
3714
+ )
3715
+
3716
+ # Validate the universe domain.
3717
+ self._client._validate_universe_domain()
3718
+
3719
+ # Send the request.
3720
+ response = await rpc(
3721
+ request,
3722
+ retry=retry,
3723
+ timeout=timeout,
3724
+ metadata=metadata,
3725
+ )
3726
+
3727
+ # Done; return the response.
3728
+ return response
3729
+
3730
+ async def reset_replica_size(
3731
+ self,
3732
+ request: Optional[
3733
+ Union[cloud_sql.SqlInstancesResetReplicaSizeRequest, dict]
3734
+ ] = None,
3735
+ *,
3736
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3737
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3738
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3739
+ ) -> cloud_sql_resources.Operation:
3740
+ r"""Reset Replica Size to primary instance disk size.
3741
+
3742
+ .. code-block:: python
3743
+
3744
+ # This snippet has been automatically generated and should be regarded as a
3745
+ # code template only.
3746
+ # It will require modifications to work:
3747
+ # - It may require correct/in-range values for request initialization.
3748
+ # - It may require specifying regional endpoints when creating the service
3749
+ # client as shown in:
3750
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3751
+ from google.cloud import sqladmin_v1beta4
3752
+
3753
+ async def sample_reset_replica_size():
3754
+ # Create a client
3755
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3756
+
3757
+ # Initialize request argument(s)
3758
+ request = sqladmin_v1beta4.SqlInstancesResetReplicaSizeRequest(
3759
+ )
3760
+
3761
+ # Make the request
3762
+ response = await client.reset_replica_size(request=request)
3763
+
3764
+ # Handle the response
3765
+ print(response)
3766
+
3767
+ Args:
3768
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesResetReplicaSizeRequest, dict]]):
3769
+ The request object. Instance reset replica size request.
3770
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3771
+ should be retried.
3772
+ timeout (float): The timeout for this request.
3773
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3774
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3775
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3776
+ be of type `bytes`.
3777
+
3778
+ Returns:
3779
+ google.cloud.sqladmin_v1beta4.types.Operation:
3780
+ An Operation resource.&nbsp;For
3781
+ successful operations that return an
3782
+ Operation resource, only the fields
3783
+ relevant to the operation are populated
3784
+ in the resource.
3785
+
3786
+ """
3787
+ # Create or coerce a protobuf request object.
3788
+ # - Use the request object if provided (there's no risk of modifying the input as
3789
+ # there are no flattened fields), or create one.
3790
+ if not isinstance(request, cloud_sql.SqlInstancesResetReplicaSizeRequest):
3791
+ request = cloud_sql.SqlInstancesResetReplicaSizeRequest(request)
3792
+
3793
+ # Wrap the RPC method; this adds retry and timeout information,
3794
+ # and friendly error handling.
3795
+ rpc = self._client._transport._wrapped_methods[
3796
+ self._client._transport.reset_replica_size
3797
+ ]
3798
+
3799
+ # Certain fields should be provided within the metadata header;
3800
+ # add these here.
3801
+ metadata = tuple(metadata) + (
3802
+ gapic_v1.routing_header.to_grpc_metadata(
3803
+ (
3804
+ ("project", request.project),
3805
+ ("instance", request.instance),
3806
+ )
3807
+ ),
3808
+ )
3809
+
3810
+ # Validate the universe domain.
3811
+ self._client._validate_universe_domain()
3812
+
3813
+ # Send the request.
3814
+ response = await rpc(
3815
+ request,
3816
+ retry=retry,
3817
+ timeout=timeout,
3818
+ metadata=metadata,
3819
+ )
3820
+
3821
+ # Done; return the response.
3822
+ return response
3823
+
3824
+ async def get_latest_recovery_time(
3825
+ self,
3826
+ request: Optional[
3827
+ Union[cloud_sql.SqlInstancesGetLatestRecoveryTimeRequest, dict]
3828
+ ] = None,
3829
+ *,
3830
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3831
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3832
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3833
+ ) -> cloud_sql.SqlInstancesGetLatestRecoveryTimeResponse:
3834
+ r"""Get Latest Recovery Time for a given instance.
3835
+
3836
+ .. code-block:: python
3837
+
3838
+ # This snippet has been automatically generated and should be regarded as a
3839
+ # code template only.
3840
+ # It will require modifications to work:
3841
+ # - It may require correct/in-range values for request initialization.
3842
+ # - It may require specifying regional endpoints when creating the service
3843
+ # client as shown in:
3844
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3845
+ from google.cloud import sqladmin_v1beta4
3846
+
3847
+ async def sample_get_latest_recovery_time():
3848
+ # Create a client
3849
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3850
+
3851
+ # Initialize request argument(s)
3852
+ request = sqladmin_v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(
3853
+ )
3854
+
3855
+ # Make the request
3856
+ response = await client.get_latest_recovery_time(request=request)
3857
+
3858
+ # Handle the response
3859
+ print(response)
3860
+
3861
+ Args:
3862
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesGetLatestRecoveryTimeRequest, dict]]):
3863
+ The request object. Instance get latest recovery time
3864
+ request.
3865
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3866
+ should be retried.
3867
+ timeout (float): The timeout for this request.
3868
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3869
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3870
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3871
+ be of type `bytes`.
3872
+
3873
+ Returns:
3874
+ google.cloud.sqladmin_v1beta4.types.SqlInstancesGetLatestRecoveryTimeResponse:
3875
+ Instance get latest recovery time
3876
+ response.
3877
+
3878
+ """
3879
+ # Create or coerce a protobuf request object.
3880
+ # - Use the request object if provided (there's no risk of modifying the input as
3881
+ # there are no flattened fields), or create one.
3882
+ if not isinstance(request, cloud_sql.SqlInstancesGetLatestRecoveryTimeRequest):
3883
+ request = cloud_sql.SqlInstancesGetLatestRecoveryTimeRequest(request)
3884
+
3885
+ # Wrap the RPC method; this adds retry and timeout information,
3886
+ # and friendly error handling.
3887
+ rpc = self._client._transport._wrapped_methods[
3888
+ self._client._transport.get_latest_recovery_time
3889
+ ]
3890
+
3891
+ # Certain fields should be provided within the metadata header;
3892
+ # add these here.
3893
+ metadata = tuple(metadata) + (
3894
+ gapic_v1.routing_header.to_grpc_metadata(
3895
+ (
3896
+ ("project", request.project),
3897
+ ("instance", request.instance),
3898
+ )
3899
+ ),
3900
+ )
3901
+
3902
+ # Validate the universe domain.
3903
+ self._client._validate_universe_domain()
3904
+
3905
+ # Send the request.
3906
+ response = await rpc(
3907
+ request,
3908
+ retry=retry,
3909
+ timeout=timeout,
3910
+ metadata=metadata,
3911
+ )
3912
+
3913
+ # Done; return the response.
3914
+ return response
3915
+
3916
+ async def execute_sql(
3917
+ self,
3918
+ request: Optional[Union[cloud_sql.SqlInstancesExecuteSqlRequest, dict]] = None,
3919
+ *,
3920
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
3921
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3922
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3923
+ ) -> cloud_sql.SqlInstancesExecuteSqlResponse:
3924
+ r"""Execute SQL statements.
3925
+
3926
+ .. code-block:: python
3927
+
3928
+ # This snippet has been automatically generated and should be regarded as a
3929
+ # code template only.
3930
+ # It will require modifications to work:
3931
+ # - It may require correct/in-range values for request initialization.
3932
+ # - It may require specifying regional endpoints when creating the service
3933
+ # client as shown in:
3934
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3935
+ from google.cloud import sqladmin_v1beta4
3936
+
3937
+ async def sample_execute_sql():
3938
+ # Create a client
3939
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
3940
+
3941
+ # Initialize request argument(s)
3942
+ request = sqladmin_v1beta4.SqlInstancesExecuteSqlRequest(
3943
+ instance="instance_value",
3944
+ project="project_value",
3945
+ )
3946
+
3947
+ # Make the request
3948
+ response = await client.execute_sql(request=request)
3949
+
3950
+ # Handle the response
3951
+ print(response)
3952
+
3953
+ Args:
3954
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesExecuteSqlRequest, dict]]):
3955
+ The request object. Execute SQL statements request.
3956
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3957
+ should be retried.
3958
+ timeout (float): The timeout for this request.
3959
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3960
+ sent along with the request as metadata. Normally, each value must be of type `str`,
3961
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
3962
+ be of type `bytes`.
3963
+
3964
+ Returns:
3965
+ google.cloud.sqladmin_v1beta4.types.SqlInstancesExecuteSqlResponse:
3966
+ Execute SQL statements response.
3967
+ """
3968
+ # Create or coerce a protobuf request object.
3969
+ # - Use the request object if provided (there's no risk of modifying the input as
3970
+ # there are no flattened fields), or create one.
3971
+ if not isinstance(request, cloud_sql.SqlInstancesExecuteSqlRequest):
3972
+ request = cloud_sql.SqlInstancesExecuteSqlRequest(request)
3973
+
3974
+ # Wrap the RPC method; this adds retry and timeout information,
3975
+ # and friendly error handling.
3976
+ rpc = self._client._transport._wrapped_methods[
3977
+ self._client._transport.execute_sql
3978
+ ]
3979
+
3980
+ # Certain fields should be provided within the metadata header;
3981
+ # add these here.
3982
+ metadata = tuple(metadata) + (
3983
+ gapic_v1.routing_header.to_grpc_metadata(
3984
+ (
3985
+ ("project", request.project),
3986
+ ("instance", request.instance),
3987
+ )
3988
+ ),
3989
+ )
3990
+
3991
+ # Validate the universe domain.
3992
+ self._client._validate_universe_domain()
3993
+
3994
+ # Send the request.
3995
+ response = await rpc(
3996
+ request,
3997
+ retry=retry,
3998
+ timeout=timeout,
3999
+ metadata=metadata,
4000
+ )
4001
+
4002
+ # Done; return the response.
4003
+ return response
4004
+
4005
+ async def acquire_ssrs_lease(
4006
+ self,
4007
+ request: Optional[
4008
+ Union[cloud_sql.SqlInstancesAcquireSsrsLeaseRequest, dict]
4009
+ ] = None,
4010
+ *,
4011
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
4012
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
4013
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
4014
+ ) -> cloud_sql.SqlInstancesAcquireSsrsLeaseResponse:
4015
+ r"""Acquire a lease for the setup of SQL Server Reporting
4016
+ Services (SSRS).
4017
+
4018
+ .. code-block:: python
4019
+
4020
+ # This snippet has been automatically generated and should be regarded as a
4021
+ # code template only.
4022
+ # It will require modifications to work:
4023
+ # - It may require correct/in-range values for request initialization.
4024
+ # - It may require specifying regional endpoints when creating the service
4025
+ # client as shown in:
4026
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
4027
+ from google.cloud import sqladmin_v1beta4
4028
+
4029
+ async def sample_acquire_ssrs_lease():
4030
+ # Create a client
4031
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
4032
+
4033
+ # Initialize request argument(s)
4034
+ request = sqladmin_v1beta4.SqlInstancesAcquireSsrsLeaseRequest(
4035
+ instance="instance_value",
4036
+ project="project_value",
4037
+ )
4038
+
4039
+ # Make the request
4040
+ response = await client.acquire_ssrs_lease(request=request)
4041
+
4042
+ # Handle the response
4043
+ print(response)
4044
+
4045
+ Args:
4046
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesAcquireSsrsLeaseRequest, dict]]):
4047
+ The request object. Request to acquire a lease for SSRS.
4048
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
4049
+ should be retried.
4050
+ timeout (float): The timeout for this request.
4051
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
4052
+ sent along with the request as metadata. Normally, each value must be of type `str`,
4053
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
4054
+ be of type `bytes`.
4055
+
4056
+ Returns:
4057
+ google.cloud.sqladmin_v1beta4.types.SqlInstancesAcquireSsrsLeaseResponse:
4058
+ Acquire SSRS lease response.
4059
+ """
4060
+ # Create or coerce a protobuf request object.
4061
+ # - Use the request object if provided (there's no risk of modifying the input as
4062
+ # there are no flattened fields), or create one.
4063
+ if not isinstance(request, cloud_sql.SqlInstancesAcquireSsrsLeaseRequest):
4064
+ request = cloud_sql.SqlInstancesAcquireSsrsLeaseRequest(request)
4065
+
4066
+ # Wrap the RPC method; this adds retry and timeout information,
4067
+ # and friendly error handling.
4068
+ rpc = self._client._transport._wrapped_methods[
4069
+ self._client._transport.acquire_ssrs_lease
4070
+ ]
4071
+
4072
+ # Certain fields should be provided within the metadata header;
4073
+ # add these here.
4074
+ metadata = tuple(metadata) + (
4075
+ gapic_v1.routing_header.to_grpc_metadata(
4076
+ (
4077
+ ("project", request.project),
4078
+ ("instance", request.instance),
4079
+ )
4080
+ ),
4081
+ )
4082
+
4083
+ # Validate the universe domain.
4084
+ self._client._validate_universe_domain()
4085
+
4086
+ # Send the request.
4087
+ response = await rpc(
4088
+ request,
4089
+ retry=retry,
4090
+ timeout=timeout,
4091
+ metadata=metadata,
4092
+ )
4093
+
4094
+ # Done; return the response.
4095
+ return response
4096
+
4097
+ async def release_ssrs_lease(
4098
+ self,
4099
+ request: Optional[
4100
+ Union[cloud_sql.SqlInstancesReleaseSsrsLeaseRequest, dict]
4101
+ ] = None,
4102
+ *,
4103
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
4104
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
4105
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
4106
+ ) -> cloud_sql.SqlInstancesReleaseSsrsLeaseResponse:
4107
+ r"""Release a lease for the setup of SQL Server Reporting
4108
+ Services (SSRS).
4109
+
4110
+ .. code-block:: python
4111
+
4112
+ # This snippet has been automatically generated and should be regarded as a
4113
+ # code template only.
4114
+ # It will require modifications to work:
4115
+ # - It may require correct/in-range values for request initialization.
4116
+ # - It may require specifying regional endpoints when creating the service
4117
+ # client as shown in:
4118
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
4119
+ from google.cloud import sqladmin_v1beta4
4120
+
4121
+ async def sample_release_ssrs_lease():
4122
+ # Create a client
4123
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
4124
+
4125
+ # Initialize request argument(s)
4126
+ request = sqladmin_v1beta4.SqlInstancesReleaseSsrsLeaseRequest(
4127
+ instance="instance_value",
4128
+ project="project_value",
4129
+ )
4130
+
4131
+ # Make the request
4132
+ response = await client.release_ssrs_lease(request=request)
4133
+
4134
+ # Handle the response
4135
+ print(response)
4136
+
4137
+ Args:
4138
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesReleaseSsrsLeaseRequest, dict]]):
4139
+ The request object. Request to release a lease for SSRS.
4140
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
4141
+ should be retried.
4142
+ timeout (float): The timeout for this request.
4143
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
4144
+ sent along with the request as metadata. Normally, each value must be of type `str`,
4145
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
4146
+ be of type `bytes`.
4147
+
4148
+ Returns:
4149
+ google.cloud.sqladmin_v1beta4.types.SqlInstancesReleaseSsrsLeaseResponse:
4150
+ The response for the release of the
4151
+ SSRS lease.
4152
+
4153
+ """
4154
+ # Create or coerce a protobuf request object.
4155
+ # - Use the request object if provided (there's no risk of modifying the input as
4156
+ # there are no flattened fields), or create one.
4157
+ if not isinstance(request, cloud_sql.SqlInstancesReleaseSsrsLeaseRequest):
4158
+ request = cloud_sql.SqlInstancesReleaseSsrsLeaseRequest(request)
4159
+
4160
+ # Wrap the RPC method; this adds retry and timeout information,
4161
+ # and friendly error handling.
4162
+ rpc = self._client._transport._wrapped_methods[
4163
+ self._client._transport.release_ssrs_lease
4164
+ ]
4165
+
4166
+ # Certain fields should be provided within the metadata header;
4167
+ # add these here.
4168
+ metadata = tuple(metadata) + (
4169
+ gapic_v1.routing_header.to_grpc_metadata(
4170
+ (
4171
+ ("project", request.project),
4172
+ ("instance", request.instance),
4173
+ )
4174
+ ),
4175
+ )
4176
+
4177
+ # Validate the universe domain.
4178
+ self._client._validate_universe_domain()
4179
+
4180
+ # Send the request.
4181
+ response = await rpc(
4182
+ request,
4183
+ retry=retry,
4184
+ timeout=timeout,
4185
+ metadata=metadata,
4186
+ )
4187
+
4188
+ # Done; return the response.
4189
+ return response
4190
+
4191
+ async def pre_check_major_version_upgrade(
4192
+ self,
4193
+ request: Optional[
4194
+ Union[cloud_sql.SqlInstancesPreCheckMajorVersionUpgradeRequest, dict]
4195
+ ] = None,
4196
+ *,
4197
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
4198
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
4199
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
4200
+ ) -> cloud_sql_resources.Operation:
4201
+ r"""Execute MVU Pre-checks
4202
+
4203
+ .. code-block:: python
4204
+
4205
+ # This snippet has been automatically generated and should be regarded as a
4206
+ # code template only.
4207
+ # It will require modifications to work:
4208
+ # - It may require correct/in-range values for request initialization.
4209
+ # - It may require specifying regional endpoints when creating the service
4210
+ # client as shown in:
4211
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
4212
+ from google.cloud import sqladmin_v1beta4
4213
+
4214
+ async def sample_pre_check_major_version_upgrade():
4215
+ # Create a client
4216
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
4217
+
4218
+ # Initialize request argument(s)
4219
+ body = sqladmin_v1beta4.InstancesPreCheckMajorVersionUpgradeRequest()
4220
+ body.pre_check_major_version_upgrade_context.target_database_version = "SQLSERVER_2025_EXPRESS"
4221
+
4222
+ request = sqladmin_v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(
4223
+ instance="instance_value",
4224
+ project="project_value",
4225
+ body=body,
4226
+ )
4227
+
4228
+ # Make the request
4229
+ response = await client.pre_check_major_version_upgrade(request=request)
4230
+
4231
+ # Handle the response
4232
+ print(response)
4233
+
4234
+ Args:
4235
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesPreCheckMajorVersionUpgradeRequest, dict]]):
4236
+ The request object. Request for Pre-checks for MVU
4237
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
4238
+ should be retried.
4239
+ timeout (float): The timeout for this request.
4240
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
4241
+ sent along with the request as metadata. Normally, each value must be of type `str`,
4242
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
4243
+ be of type `bytes`.
4244
+
4245
+ Returns:
4246
+ google.cloud.sqladmin_v1beta4.types.Operation:
4247
+ An Operation resource.&nbsp;For
4248
+ successful operations that return an
4249
+ Operation resource, only the fields
4250
+ relevant to the operation are populated
4251
+ in the resource.
4252
+
4253
+ """
4254
+ # Create or coerce a protobuf request object.
4255
+ # - Use the request object if provided (there's no risk of modifying the input as
4256
+ # there are no flattened fields), or create one.
4257
+ if not isinstance(
4258
+ request, cloud_sql.SqlInstancesPreCheckMajorVersionUpgradeRequest
4259
+ ):
4260
+ request = cloud_sql.SqlInstancesPreCheckMajorVersionUpgradeRequest(request)
4261
+
4262
+ # Wrap the RPC method; this adds retry and timeout information,
4263
+ # and friendly error handling.
4264
+ rpc = self._client._transport._wrapped_methods[
4265
+ self._client._transport.pre_check_major_version_upgrade
4266
+ ]
4267
+
4268
+ # Certain fields should be provided within the metadata header;
4269
+ # add these here.
4270
+ metadata = tuple(metadata) + (
4271
+ gapic_v1.routing_header.to_grpc_metadata(
4272
+ (
4273
+ ("project", request.project),
4274
+ ("instance", request.instance),
4275
+ )
4276
+ ),
4277
+ )
4278
+
4279
+ # Validate the universe domain.
4280
+ self._client._validate_universe_domain()
4281
+
4282
+ # Send the request.
4283
+ response = await rpc(
4284
+ request,
4285
+ retry=retry,
4286
+ timeout=timeout,
4287
+ metadata=metadata,
4288
+ )
4289
+
4290
+ # Done; return the response.
4291
+ return response
4292
+
4293
+ async def point_in_time_restore(
4294
+ self,
4295
+ request: Optional[
4296
+ Union[cloud_sql.SqlInstancesPointInTimeRestoreRequest, dict]
4297
+ ] = None,
4298
+ *,
4299
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
4300
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
4301
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
4302
+ ) -> cloud_sql_resources.Operation:
4303
+ r"""Point in time restore for an instance managed by
4304
+ Google Cloud Backup and Disaster Recovery.
4305
+
4306
+ .. code-block:: python
4307
+
4308
+ # This snippet has been automatically generated and should be regarded as a
4309
+ # code template only.
4310
+ # It will require modifications to work:
4311
+ # - It may require correct/in-range values for request initialization.
4312
+ # - It may require specifying regional endpoints when creating the service
4313
+ # client as shown in:
4314
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
4315
+ from google.cloud import sqladmin_v1beta4
4316
+
4317
+ async def sample_point_in_time_restore():
4318
+ # Create a client
4319
+ client = sqladmin_v1beta4.SqlInstancesServiceAsyncClient()
4320
+
4321
+ # Initialize request argument(s)
4322
+ request = sqladmin_v1beta4.SqlInstancesPointInTimeRestoreRequest(
4323
+ parent="parent_value",
4324
+ )
4325
+
4326
+ # Make the request
4327
+ response = await client.point_in_time_restore(request=request)
4328
+
4329
+ # Handle the response
4330
+ print(response)
4331
+
4332
+ Args:
4333
+ request (Optional[Union[google.cloud.sqladmin_v1beta4.types.SqlInstancesPointInTimeRestoreRequest, dict]]):
4334
+ The request object. Request to perform a point in time
4335
+ restore on a Google Cloud Backup and
4336
+ Disaster Recovery managed instance.
4337
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
4338
+ should be retried.
4339
+ timeout (float): The timeout for this request.
4340
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
4341
+ sent along with the request as metadata. Normally, each value must be of type `str`,
4342
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
4343
+ be of type `bytes`.
4344
+
4345
+ Returns:
4346
+ google.cloud.sqladmin_v1beta4.types.Operation:
4347
+ An Operation resource.&nbsp;For
4348
+ successful operations that return an
4349
+ Operation resource, only the fields
4350
+ relevant to the operation are populated
4351
+ in the resource.
4352
+
4353
+ """
4354
+ # Create or coerce a protobuf request object.
4355
+ # - Use the request object if provided (there's no risk of modifying the input as
4356
+ # there are no flattened fields), or create one.
4357
+ if not isinstance(request, cloud_sql.SqlInstancesPointInTimeRestoreRequest):
4358
+ request = cloud_sql.SqlInstancesPointInTimeRestoreRequest(request)
4359
+
4360
+ # Wrap the RPC method; this adds retry and timeout information,
4361
+ # and friendly error handling.
4362
+ rpc = self._client._transport._wrapped_methods[
4363
+ self._client._transport.point_in_time_restore
4364
+ ]
4365
+
4366
+ # Certain fields should be provided within the metadata header;
4367
+ # add these here.
4368
+ metadata = tuple(metadata) + (
4369
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
4370
+ )
4371
+
4372
+ # Validate the universe domain.
4373
+ self._client._validate_universe_domain()
4374
+
4375
+ # Send the request.
4376
+ response = await rpc(
4377
+ request,
4378
+ retry=retry,
4379
+ timeout=timeout,
4380
+ metadata=metadata,
4381
+ )
4382
+
4383
+ # Done; return the response.
4384
+ return response
4385
+
4386
+ async def __aenter__(self) -> "SqlInstancesServiceAsyncClient":
4387
+ return self
4388
+
4389
+ async def __aexit__(self, exc_type, exc, tb):
4390
+ await self.transport.close()
4391
+
4392
+
4393
+ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
4394
+ gapic_version=package_version.__version__
4395
+ )
4396
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
4397
+
4398
+
4399
+ __all__ = ("SqlInstancesServiceAsyncClient",)