GoogleCloudPlatform / alloydb-python-connector

A Python library for connecting securely to your AlloyDB instances.
Apache License 2.0
28 stars 7 forks source link

Allow `IPTypes` or string for setting `ip_type` #247

Closed jackwotherspoon closed 7 months ago

jackwotherspoon commented 8 months ago

If users want to configure Public IP they currently need to import IPTypes first and then set ip_type=IPTypes.PUBLIC in the Connector config or during their call to connect.

from google.cloud.alloydb.connector import IPTypes

This is an extra step that is unnecessary, we should support users passing in the IPTypes enum or the string literal value that the enum maps to (i.e "PUBLIC"). This will allow users to not have to import the additional class.

https://github.com/GoogleCloudPlatform/alloydb-python-connector/blob/39396eee6ab5a6c8616448fc318f50fdf981db3e/google/cloud/alloydb/connector/instance.py#L44-L50