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