3333class Connector :
3434 """A class to configure and create connections to Cloud SQL instances.
3535
36- :type ip_types : IPTypes
37- :param ip_types
36+ :type ip_type : IPTypes
37+ :param ip_type
3838 The IP type (public or private) used to connect. IP types
3939 can be either IPTypes.PUBLIC or IPTypes.PRIVATE.
4040
@@ -54,7 +54,7 @@ class Connector:
5454
5555 def __init__ (
5656 self ,
57- ip_types : IPTypes = IPTypes .PUBLIC ,
57+ ip_type : IPTypes = IPTypes .PUBLIC ,
5858 enable_iam_auth : bool = False ,
5959 timeout : int = 30 ,
6060 credentials : Optional [Credentials ] = None ,
@@ -70,7 +70,7 @@ def __init__(
7070 # set default params for connections
7171 self ._timeout = timeout
7272 self ._enable_iam_auth = enable_iam_auth
73- self ._ip_types = ip_types
73+ self ._ip_type = ip_type
7474 self ._credentials = credentials
7575
7676 def connect (
@@ -123,15 +123,22 @@ def connect(
123123 )
124124 self ._instances [instance_connection_string ] = icm
125125
126- ip_types = kwargs .pop ("ip_types" , self ._ip_types )
126+ if "ip_types" in kwargs :
127+ ip_type = kwargs .pop ("ip_types" )
128+ logger .warning (
129+ "Deprecation Warning: Parameter `ip_types` is deprecated and may be removed"
130+ "in a future release. Please use `ip_type` instead."
131+ )
132+ else :
133+ ip_type = kwargs .pop ("ip_type" , self ._ip_type )
127134 if "timeout" in kwargs :
128- return icm .connect (driver , ip_types , ** kwargs )
135+ return icm .connect (driver , ip_type , ** kwargs )
129136 elif "connect_timeout" in kwargs :
130137 timeout = kwargs ["connect_timeout" ]
131138 else :
132139 timeout = self ._timeout
133140 try :
134- return icm .connect (driver , ip_types , timeout , ** kwargs )
141+ return icm .connect (driver , ip_type , timeout , ** kwargs )
135142 except Exception as e :
136143 # with any other exception, we attempt a force refresh, then throw the error
137144 icm .force_refresh ()
0 commit comments