SqlInstancesServiceClient(
*,
credentials: typing.Optional[google.auth.credentials.Credentials] = None,
transport: typing.Optional[
typing.Union[
str,
google.cloud.sqladmin_v1.services.sql_instances_service.transports.base.SqlInstancesServiceTransport,
typing.Callable[
[...],
google.cloud.sqladmin_v1.services.sql_instances_service.transports.base.SqlInstancesServiceTransport,
],
]
] = None,
client_options: typing.Optional[
typing.Union[google.api_core.client_options.ClientOptions, dict]
] = None,
client_info: google.api_core.gapic_v1.client_info.ClientInfo = google.api_core.gapic_v1.client_info.ClientInfo
)Service to manage Cloud SQL instances.
Properties
api_endpoint
Return the API endpoint used by the client instance.
| Returns | |
|---|---|
| Type | Description |
str |
The API endpoint used by the client instance. |
transport
Returns the transport used by the client instance.
| Returns | |
|---|---|
| Type | Description |
SqlInstancesServiceTransport |
The transport used by the client instance. |
universe_domain
Return the universe domain used by the client instance.
| Returns | |
|---|---|
| Type | Description |
str |
The universe domain used by the client instance. |
Methods
SqlInstancesServiceClient
SqlInstancesServiceClient(
*,
credentials: typing.Optional[google.auth.credentials.Credentials] = None,
transport: typing.Optional[
typing.Union[
str,
google.cloud.sqladmin_v1.services.sql_instances_service.transports.base.SqlInstancesServiceTransport,
typing.Callable[
[...],
google.cloud.sqladmin_v1.services.sql_instances_service.transports.base.SqlInstancesServiceTransport,
],
]
] = None,
client_options: typing.Optional[
typing.Union[google.api_core.client_options.ClientOptions, dict]
] = None,
client_info: google.api_core.gapic_v1.client_info.ClientInfo = google.api_core.gapic_v1.client_info.ClientInfo
)Instantiates the sql instances service client.
| Parameters | |
|---|---|
| Name | Description |
credentials |
Optional[google.auth.credentials.Credentials]
The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. |
transport |
Optional[Union[str,SqlInstancesServiceTransport,Callable[..., SqlInstancesServiceTransport]]]
The transport to use, or a Callable that constructs and returns a new transport. If a Callable is given, it will be called with the same set of initialization arguments as used in the SqlInstancesServiceTransport constructor. If set to None, a transport is chosen automatically. |
client_options |
Optional[Union[google.api_core.client_options.ClientOptions, dict]]
Custom options for the client. 1. The |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
| Exceptions | |
|---|---|
| Type | Description |
google.auth.exceptions.MutualTLSChannelError |
If mutual TLS transport creation failed for any reason. |
__exit__
__exit__(type, value, traceback)Releases underlying transport's resources.
acquire_ssrs_lease
acquire_ssrs_lease(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesAcquireSsrsLeaseRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesAcquireSsrsLeaseResponse
)Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_acquire_ssrs_lease():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesAcquireSsrsLeaseRequest(
instance="instance_value",
project="project_value",
)
# Make the request
response = client.acquire_ssrs_lease(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesAcquireSsrsLeaseRequest, dict]
The request object. Request to acquire a lease for SSRS. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.SqlInstancesAcquireSsrsLeaseResponse |
Response for the acquire SSRS lease request. |
add_entra_id_certificate
add_entra_id_certificate(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesAddEntraIdCertificateRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationAdds a new Entra ID certificate for the specified instance. If an Entra ID certificate was previously added but never used in a certificate rotation, this operation replaces that version.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_add_entra_id_certificate():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesAddEntraIdCertificateRequest(
instance="instance_value",
project="project_value",
)
# Make the request
response = client.add_entra_id_certificate(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesAddEntraIdCertificateRequest, dict]
The request object. Instance add Entra ID certificate request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
add_server_ca
add_server_ca(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesAddServerCaRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationAdds a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in. For instances that have enabled Certificate Authority Service (CAS) based server CA, use AddServerCertificate to add a new server certificate.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_add_server_ca():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesAddServerCaRequest(
)
# Make the request
response = client.add_server_ca(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesAddServerCaRequest, dict]
The request object. Instance add server CA request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
add_server_certificate
add_server_certificate(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesAddServerCertificateRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationAdd a new trusted server certificate version for the specified instance using Certificate Authority Service (CAS) server CA. Required to prepare for a certificate rotation. If a server certificate version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one certificate version waiting to be rotated in. For instances not using CAS server CA, use AddServerCa instead.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_add_server_certificate():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesAddServerCertificateRequest(
)
# Make the request
response = client.add_server_certificate(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesAddServerCertificateRequest, dict]
The request object. Instance add server certificate request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
backup_dr_backup_path
backup_dr_backup_path(
project: str, location: str, backupvault: str, datasource: str, backup: str
) -> strReturns a fully-qualified backup_dr_backup string.
backup_path
backup_path(project: str, backup: str) -> strReturns a fully-qualified backup string.
clone
clone(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesCloneRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationCreates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_clone():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
body = sqladmin_v1.InstancesCloneRequest()
body.clone_context.destination_instance_name = "destination_instance_name_value"
request = sqladmin_v1.SqlInstancesCloneRequest(
instance="instance_value",
project="project_value",
body=body,
)
# Make the request
response = client.clone(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesCloneRequest, dict]
The request object. Instance clone request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
common_billing_account_path
common_billing_account_path(billing_account: str) -> strReturns a fully-qualified billing_account string.
common_folder_path
common_folder_path(folder: str) -> strReturns a fully-qualified folder string.
common_location_path
common_location_path(project: str, location: str) -> strReturns a fully-qualified location string.
common_organization_path
common_organization_path(organization: str) -> strReturns a fully-qualified organization string.
common_project_path
common_project_path(project: str) -> strReturns a fully-qualified project string.
create_ephemeral
create_ephemeral(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesCreateEphemeralCertRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.SslCertGenerates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_create_ephemeral():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesCreateEphemeralCertRequest(
)
# Make the request
response = client.create_ephemeral(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesCreateEphemeralCertRequest, dict]
The request object. Instance create ephemeral certificate request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.SslCert |
SslCerts Resource |
crypto_key_path
crypto_key_path(project: str, location: str, key_ring: str, crypto_key: str) -> strReturns a fully-qualified crypto_key string.
crypto_key_version_path
crypto_key_version_path(
project: str, location: str, key_ring: str, crypto_key: str, crypto_key_version: str
) -> strReturns a fully-qualified crypto_key_version string.
delete
delete(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesDeleteRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationDeletes a Cloud SQL instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_delete():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesDeleteRequest(
final_backup_ttl_days=2210,
)
# Make the request
response = client.delete(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesDeleteRequest, dict]
The request object. Instance delete request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
demote
demote(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesDemoteRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationDemotes an existing standalone instance to be a Cloud SQL read replica for an external database server.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_demote():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
body = sqladmin_v1.InstancesDemoteRequest()
body.demote_context.source_representative_instance_name = "source_representative_instance_name_value"
request = sqladmin_v1.SqlInstancesDemoteRequest(
instance="instance_value",
project="project_value",
body=body,
)
# Make the request
response = client.demote(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesDemoteRequest, dict]
The request object. Instance demote request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
demote_master
demote_master(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesDemoteMasterRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationDemotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_demote_master():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesDemoteMasterRequest(
)
# Make the request
response = client.demote_master(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesDemoteMasterRequest, dict]
The request object. Instance demote master request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
execute_sql
execute_sql(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesExecuteSqlRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesExecuteSqlResponseExecute SQL statements.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_execute_sql():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesExecuteSqlRequest(
instance="instance_value",
project="project_value",
)
# Make the request
response = client.execute_sql(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesExecuteSqlRequest, dict]
The request object. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
export
export(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesExportRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationExports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_export():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesExportRequest(
)
# Make the request
response = client.export(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesExportRequest, dict]
The request object. Instance export request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
failover
failover(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesFailoverRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationInitiates a manual failover of a high availability (HA) primary
instance to a standby instance, which becomes the primary
instance. Users are then rerouted to the new primary. For more
information, see the Overview of high
availability <https://cloud.google.com/sql/docs/mysql/high-availability>__
page in the Cloud SQL documentation. If using Legacy HA (MySQL
only), this causes the instance to failover to its failover
replica instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_failover():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesFailoverRequest(
)
# Make the request
response = client.failover(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesFailoverRequest, dict]
The request object. Instance failover request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
from_service_account_file
from_service_account_file(filename: str, *args, **kwargs)Creates an instance of this client using the provided credentials file.
| Parameter | |
|---|---|
| Name | Description |
filename |
str
The path to the service account private key json file. |
| Returns | |
|---|---|
| Type | Description |
SqlInstancesServiceClient |
The constructed client. |
from_service_account_info
from_service_account_info(info: dict, *args, **kwargs)Creates an instance of this client using the provided credentials info.
| Parameter | |
|---|---|
| Name | Description |
info |
dict
The service account private key info. |
| Returns | |
|---|---|
| Type | Description |
SqlInstancesServiceClient |
The constructed client. |
from_service_account_json
from_service_account_json(filename: str, *args, **kwargs)Creates an instance of this client using the provided credentials file.
| Parameter | |
|---|---|
| Name | Description |
filename |
str
The path to the service account private key json file. |
| Returns | |
|---|---|
| Type | Description |
SqlInstancesServiceClient |
The constructed client. |
get
get(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesGetRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_instances.DatabaseInstanceRetrieves a resource containing information about a Cloud SQL instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_get():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesGetRequest(
instance="instance_value",
project="project_value",
)
# Make the request
response = client.get(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesGetRequest, dict]
The request object. Instance get request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.DatabaseInstance |
A Cloud SQL instance resource. |
get_disk_shrink_config
get_disk_shrink_config(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesGetDiskShrinkConfigRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesGetDiskShrinkConfigResponse
)Get Disk Shrink Config for a given instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_get_disk_shrink_config():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesGetDiskShrinkConfigRequest(
)
# Make the request
response = client.get_disk_shrink_config(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesGetDiskShrinkConfigRequest, dict]
The request object. Instance get disk shrink config request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.SqlInstancesGetDiskShrinkConfigResponse |
Instance get disk shrink config response. |
get_latest_recovery_time
get_latest_recovery_time(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesGetLatestRecoveryTimeRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesGetLatestRecoveryTimeResponse
)Get Latest Recovery Time for a given instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_get_latest_recovery_time():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesGetLatestRecoveryTimeRequest(
)
# Make the request
response = client.get_latest_recovery_time(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesGetLatestRecoveryTimeRequest, dict]
The request object. Instance get latest recovery time request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.SqlInstancesGetLatestRecoveryTimeResponse |
Instance get latest recovery time response. |
get_mtls_endpoint_and_cert_source
get_mtls_endpoint_and_cert_source(
client_options: typing.Optional[
google.api_core.client_options.ClientOptions
] = None,
)Deprecated. Return the API endpoint and client cert source for mutual TLS.
The client cert source is determined in the following order:
(1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not "true", the
client cert source is None.
(2) if client_options.client_cert_source is provided, use the provided one; if the
default client cert source exists, use the default one; otherwise the client cert
source is None.
The API endpoint is determined in the following order:
(1) if client_options.api_endpoint if provided, use the provided one.
(2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is "always", use the
default mTLS endpoint; if the environment variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
More details can be found at https://google.aip.dev/auth/4114.
| Parameter | |
|---|---|
| Name | Description |
client_options |
google.api_core.client_options.ClientOptions
Custom options for the client. Only the |
| Exceptions | |
|---|---|
| Type | Description |
google.auth.exceptions.MutualTLSChannelError |
If any errors happen. |
| Returns | |
|---|---|
| Type | Description |
Tuple[str, Callable[[], Tuple[bytes, bytes]]] |
returns the API endpoint and the client cert source to use. |
import_
import_(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesImportRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationImports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_import():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesImportRequest(
)
# Make the request
response = client.import_(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesImportRequest, dict]
The request object. Instance import request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
insert
insert(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesInsertRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationCreates a new Cloud SQL instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_insert():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesInsertRequest(
)
# Make the request
response = client.insert(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesInsertRequest, dict]
The request object. Instance insert request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
list
list(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesListRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.services.sql_instances_service.pagers.ListPagerLists instances under a given project.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_list():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesListRequest(
)
# Make the request
page_result = client.list(request=request)
# Handle the response
for response in page_result:
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesListRequest, dict]
The request object. Instance list request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.services.sql_instances_service.pagers.ListPager |
Database instances list response. Iterating over this object will yield results and resolve additional pages automatically. |
list_entra_id_certificates
list_entra_id_certificates(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesListEntraIdCertificatesRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.sqladmin_v1.types.cloud_sql_instances.InstancesListEntraIdCertificatesResponse
)Lists all versions of EntraID certificates for the specified instance. There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_list_entra_id_certificates():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesListEntraIdCertificatesRequest(
instance="instance_value",
project="project_value",
)
# Make the request
response = client.list_entra_id_certificates(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesListEntraIdCertificatesRequest, dict]
The request object. Instance list Entra ID certificates request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.InstancesListEntraIdCertificatesResponse |
Instances ListEntraIdCertificates response. |
list_server_cas
list_server_cas(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesListServerCasRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_instances.InstancesListServerCasResponseLists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_list_server_cas():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesListServerCasRequest(
)
# Make the request
response = client.list_server_cas(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesListServerCasRequest, dict]
The request object. Instance list server CAs request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.InstancesListServerCasResponse |
Instances ListServerCas response. |
list_server_certificates
list_server_certificates(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesListServerCertificatesRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.sqladmin_v1.types.cloud_sql_instances.InstancesListServerCertificatesResponse
)Lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed:
the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_list_server_certificates():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesListServerCertificatesRequest(
instance="instance_value",
project="project_value",
)
# Make the request
response = client.list_server_certificates(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesListServerCertificatesRequest, dict]
The request object. Instance list server certificates request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.InstancesListServerCertificatesResponse |
Instances ListServerCertificates response. |
network_attachment_path
network_attachment_path(project: str, region: str, network_attachment: str) -> strReturns a fully-qualified network_attachment string.
network_path
network_path(project: str, network: str) -> strReturns a fully-qualified network string.
parse_backup_dr_backup_path
parse_backup_dr_backup_path(path: str) -> typing.Dict[str, str]Parses a backup_dr_backup path into its component segments.
parse_backup_path
parse_backup_path(path: str) -> typing.Dict[str, str]Parses a backup path into its component segments.
parse_common_billing_account_path
parse_common_billing_account_path(path: str) -> typing.Dict[str, str]Parse a billing_account path into its component segments.
parse_common_folder_path
parse_common_folder_path(path: str) -> typing.Dict[str, str]Parse a folder path into its component segments.
parse_common_location_path
parse_common_location_path(path: str) -> typing.Dict[str, str]Parse a location path into its component segments.
parse_common_organization_path
parse_common_organization_path(path: str) -> typing.Dict[str, str]Parse a organization path into its component segments.
parse_common_project_path
parse_common_project_path(path: str) -> typing.Dict[str, str]Parse a project path into its component segments.
parse_crypto_key_path
parse_crypto_key_path(path: str) -> typing.Dict[str, str]Parses a crypto_key path into its component segments.
parse_crypto_key_version_path
parse_crypto_key_version_path(path: str) -> typing.Dict[str, str]Parses a crypto_key_version path into its component segments.
parse_network_attachment_path
parse_network_attachment_path(path: str) -> typing.Dict[str, str]Parses a network_attachment path into its component segments.
parse_network_path
parse_network_path(path: str) -> typing.Dict[str, str]Parses a network path into its component segments.
parse_secret_version_path
parse_secret_version_path(path: str) -> typing.Dict[str, str]Parses a secret_version path into its component segments.
parse_service_connection_policy_path
parse_service_connection_policy_path(path: str) -> typing.Dict[str, str]Parses a service_connection_policy path into its component segments.
patch
patch(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesPatchRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationPartially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_patch():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesPatchRequest(
)
# Make the request
response = client.patch(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesPatchRequest, dict]
The request object. Instance patch request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
perform_disk_shrink
perform_disk_shrink(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesPerformDiskShrinkRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationPerform Disk Shrink on primary instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_perform_disk_shrink():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesPerformDiskShrinkRequest(
)
# Make the request
response = client.perform_disk_shrink(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesPerformDiskShrinkRequest, dict]
The request object. Instance perform disk shrink request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
point_in_time_restore
point_in_time_restore(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesPointInTimeRestoreRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationPoint in time restore for an instance managed by Google Cloud Backup and Disaster Recovery.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_point_in_time_restore():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesPointInTimeRestoreRequest(
parent="parent_value",
)
# Make the request
response = client.point_in_time_restore(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesPointInTimeRestoreRequest, dict]
The request object. Request to perform a point in time restore on a Google Cloud Backup and Disaster Recovery managed instance. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
pre_check_major_version_upgrade
pre_check_major_version_upgrade(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesPreCheckMajorVersionUpgradeRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationExecute MVU Pre-checks
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_pre_check_major_version_upgrade():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
body = sqladmin_v1.InstancesPreCheckMajorVersionUpgradeRequest()
body.pre_check_major_version_upgrade_context.target_database_version = "SQLSERVER_2025_EXPRESS"
request = sqladmin_v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(
instance="instance_value",
project="project_value",
body=body,
)
# Make the request
response = client.pre_check_major_version_upgrade(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesPreCheckMajorVersionUpgradeRequest, dict]
The request object. Request for Pre-checks for MVU |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
promote_replica
promote_replica(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesPromoteReplicaRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationPromotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_promote_replica():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesPromoteReplicaRequest(
)
# Make the request
response = client.promote_replica(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesPromoteReplicaRequest, dict]
The request object. Instance promote replica request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
reencrypt
reencrypt(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesReencryptRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationReencrypt CMEK instance with latest key version.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_reencrypt():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesReencryptRequest(
)
# Make the request
response = client.reencrypt(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesReencryptRequest, dict]
The request object. Instance reencrypt request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
release_ssrs_lease
release_ssrs_lease(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesReleaseSsrsLeaseRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesReleaseSsrsLeaseResponse
)Release a lease for the setup of SQL Server Reporting Services (SSRS).
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_release_ssrs_lease():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesReleaseSsrsLeaseRequest(
instance="instance_value",
project="project_value",
)
# Make the request
response = client.release_ssrs_lease(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesReleaseSsrsLeaseRequest, dict]
The request object. Request to release a lease for SSRS. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.SqlInstancesReleaseSsrsLeaseResponse |
Response for the release SSRS lease request. |
reschedule_maintenance
reschedule_maintenance(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesRescheduleMaintenanceRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationReschedules the maintenance on the given instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_reschedule_maintenance():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesRescheduleMaintenanceRequest(
)
# Make the request
response = client.reschedule_maintenance(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesRescheduleMaintenanceRequest, dict]
The request object. Instance reschedule maintenance request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
reset_replica_size
reset_replica_size(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesResetReplicaSizeRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationReset Replica Size to primary instance disk size.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_reset_replica_size():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesResetReplicaSizeRequest(
)
# Make the request
response = client.reset_replica_size(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesResetReplicaSizeRequest, dict]
The request object. Instance reset replica size request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
reset_ssl_config
reset_ssl_config(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesResetSslConfigRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationDeletes all client certificates and generates a new server SSL certificate for the instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_reset_ssl_config():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesResetSslConfigRequest(
)
# Make the request
response = client.reset_ssl_config(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesResetSslConfigRequest, dict]
The request object. Instance reset SSL config request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
restart
restart(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesRestartRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationRestarts a Cloud SQL instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_restart():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesRestartRequest(
)
# Make the request
response = client.restart(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesRestartRequest, dict]
The request object. Instance restart request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
restore_backup
restore_backup(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesRestoreBackupRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationRestores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_restore_backup():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesRestoreBackupRequest(
)
# Make the request
response = client.restore_backup(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesRestoreBackupRequest, dict]
The request object. Instance restore backup request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
rotate_entra_id_certificate
rotate_entra_id_certificate(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesRotateEntraIdCertificateRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationRotates the server certificate version to one previously added with the addEntraIdCertificate method.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_rotate_entra_id_certificate():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesRotateEntraIdCertificateRequest(
instance="instance_value",
project="project_value",
)
# Make the request
response = client.rotate_entra_id_certificate(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesRotateEntraIdCertificateRequest, dict]
The request object. Instance rotate server certificate request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
rotate_server_ca
rotate_server_ca(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesRotateServerCaRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationRotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use RotateServerCertificate to rotate the server certificate.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_rotate_server_ca():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesRotateServerCaRequest(
)
# Make the request
response = client.rotate_server_ca(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesRotateServerCaRequest, dict]
The request object. Instance rotate server CA request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
rotate_server_certificate
rotate_server_certificate(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesRotateServerCertificateRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationRotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_rotate_server_certificate():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesRotateServerCertificateRequest(
instance="instance_value",
project="project_value",
)
# Make the request
response = client.rotate_server_certificate(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesRotateServerCertificateRequest, dict]
The request object. Instance rotate server certificate request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
secret_version_path
secret_version_path(project: str, secret: str, secret_version: str) -> strReturns a fully-qualified secret_version string.
service_connection_policy_path
service_connection_policy_path(
project: str, region: str, service_connection_policy: str
) -> strReturns a fully-qualified service_connection_policy string.
start_external_sync
start_external_sync(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesStartExternalSyncRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationStart External primary instance migration.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_start_external_sync():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesStartExternalSyncRequest(
)
# Make the request
response = client.start_external_sync(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesStartExternalSyncRequest, dict]
The request object. Instance start external sync request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
start_replica
start_replica(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesStartReplicaRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationStarts the replication in the read replica instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_start_replica():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesStartReplicaRequest(
)
# Make the request
response = client.start_replica(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesStartReplicaRequest, dict]
The request object. Instance start replica request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
stop_replica
stop_replica(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesStopReplicaRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationStops the replication in the read replica instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_stop_replica():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesStopReplicaRequest(
)
# Make the request
response = client.stop_replica(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesStopReplicaRequest, dict]
The request object. Instance stop replica request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
switchover
switchover(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesSwitchoverRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationSwitches over from the primary instance to the DR replica instance.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_switchover():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesSwitchoverRequest(
)
# Make the request
response = client.switchover(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesSwitchoverRequest, dict]
The request object. Instance switchover request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
truncate_log
truncate_log(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesTruncateLogRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationTruncate MySQL general and slow query log tables MySQL only.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_truncate_log():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesTruncateLogRequest(
)
# Make the request
response = client.truncate_log(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesTruncateLogRequest, dict]
The request object. Instance truncate log request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
update
update(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesUpdateRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> google.cloud.sqladmin_v1.types.cloud_sql_resources.OperationUpdates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_update():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesUpdateRequest(
)
# Make the request
response = client.update(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesUpdateRequest, dict]
The request object. Instance update request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.Operation |
An Operation resource. For successful operations that return an Operation resource, only the fields relevant to the operation are populated in the resource. |
verify_external_sync_settings
verify_external_sync_settings(
request: typing.Optional[
typing.Union[
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesVerifyExternalSyncSettingsRequest,
dict,
]
] = None,
*,
retry: typing.Optional[
typing.Union[
google.api_core.retry.retry_unary.Retry,
google.api_core.gapic_v1.method._MethodDefault,
]
] = _MethodDefault._DEFAULT_VALUE,
timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
metadata: typing.Sequence[typing.Tuple[str, typing.Union[str, bytes]]] = ()
) -> (
google.cloud.sqladmin_v1.types.cloud_sql_instances.SqlInstancesVerifyExternalSyncSettingsResponse
)Verify External primary instance external sync settings.
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import sqladmin_v1
def sample_verify_external_sync_settings():
# Create a client
client = sqladmin_v1.SqlInstancesServiceClient()
# Initialize request argument(s)
request = sqladmin_v1.SqlInstancesVerifyExternalSyncSettingsRequest(
)
# Make the request
response = client.verify_external_sync_settings(request=request)
# Handle the response
print(response)
| Parameters | |
|---|---|
| Name | Description |
request |
Union[google.cloud.sqladmin_v1.types.SqlInstancesVerifyExternalSyncSettingsRequest, dict]
The request object. Instance verify external sync settings request. |
retry |
google.api_core.retry.Retry
Designation of what errors, if any, should be retried. |
timeout |
float
The timeout for this request. |
metadata |
Sequence[Tuple[str, Union[str, bytes]]]
Key/value pairs which should be sent along with the request as metadata. Normally, each value must be of type |
| Returns | |
|---|---|
| Type | Description |
google.cloud.sqladmin_v1.types.SqlInstancesVerifyExternalSyncSettingsResponse |
Instance verify external sync settings response. |