Refactor of AlloyDBClient and ConnectionInfo classes.
Added the get_connection_info method to the AlloyDBClient.
This method does an immediate refresh and calls the AlloyDB APIs
to get a fresh ConnectionInfo. This allows better encapsulation.
Refactored ConnectionInfo to a dataclass and added two new methods;
create_ssl_context and get_preferred_ip. Moved all SSL/TLS configuration
within create_ssl_context. This way ConnectionInfo() prepares all the info
required to connect and then create_ssl_context will use the info to establish
the SSL/TLS connection when called from Connector.connect at the time of
connection.
Refactor of
AlloyDBClient
andConnectionInfo
classes.Added the
get_connection_info
method to the AlloyDBClient. This method does an immediate refresh and calls the AlloyDB APIs to get a freshConnectionInfo
. This allows better encapsulation.Refactored
ConnectionInfo
to a dataclass and added two new methods;create_ssl_context
andget_preferred_ip
. Moved all SSL/TLS configuration withincreate_ssl_context
. This way ConnectionInfo() prepares all the info required to connect and thencreate_ssl_context
will use the info to establish the SSL/TLS connection when called fromConnector.connect
at the time of connection.Port of https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/pull/1079 and https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/pull/1090
Related to #298