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