Skip to content

Commit 40e83d5

Browse files
Implemented support for VPC DBaaS Integration
1 parent 0b1b2af commit 40e83d5

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

linode_api4/groups/database.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Database,
1111
DatabaseEngine,
1212
DatabaseType,
13+
DatabasePrivateNetwork,
1314
MySQLDatabase,
1415
PostgreSQLDatabase,
1516
drop_null_keys,
@@ -126,6 +127,7 @@ def mysql_create(
126127
engine,
127128
ltype,
128129
engine_config: Union[MySQLDatabaseConfigOptions, Dict[str, Any]] = None,
130+
private_network: Union[DatabasePrivateNetwork, Dict[str, Any]] = None,
129131
**kwargs,
130132
):
131133
"""
@@ -159,6 +161,8 @@ def mysql_create(
159161
:type ltype: str or Type
160162
:param engine_config: The configuration options for this MySQL cluster
161163
:type engine_config: Dict[str, Any] or MySQLDatabaseConfigOptions
164+
:param private_network: The private network settings to use for this cluster
165+
:type private_network: Dict[str, Any] or DatabasePrivateNetwork
162166
"""
163167

164168
params = {
@@ -167,6 +171,7 @@ def mysql_create(
167171
"engine": engine,
168172
"type": ltype,
169173
"engine_config": engine_config,
174+
"private_network": private_network,
170175
}
171176
params.update(kwargs)
172177

@@ -262,6 +267,7 @@ def postgresql_create(
262267
engine_config: Union[
263268
PostgreSQLDatabaseConfigOptions, Dict[str, Any]
264269
] = None,
270+
private_network: Union[DatabasePrivateNetwork, Dict[str, Any]] = None,
265271
**kwargs,
266272
):
267273
"""
@@ -295,6 +301,8 @@ def postgresql_create(
295301
:type ltype: str or Type
296302
:param engine_config: The configuration options for this PostgreSQL cluster
297303
:type engine_config: Dict[str, Any] or PostgreSQLDatabaseConfigOptions
304+
:param private_network: The private network settings to use for this cluster
305+
:type private_network: Dict[str, Any] or DatabasePrivateNetwork
298306
"""
299307

300308
params = {
@@ -303,6 +311,7 @@ def postgresql_create(
303311
"engine": engine,
304312
"type": ltype,
305313
"engine_config": engine_config,
314+
"private_network": private_network,
306315
}
307316
params.update(kwargs)
308317

linode_api4/objects/database.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ def invalidate(self):
7373

7474
Base.invalidate(self)
7575

76+
@dataclass
77+
class DatabasePrivateNetwork(JSONObject):
78+
"""
79+
DatabasePrivateNetwork is used to specify
80+
a Database Cluster's private network settings during its creation.
81+
"""
82+
vpc_id: int
83+
subnet_id: int
84+
public_access: bool
7685

7786
@deprecated(
7887
reason="Backups are not supported for non-legacy database clusters."
@@ -304,6 +313,7 @@ class MySQLDatabase(Base):
304313
"engine_config": Property(
305314
mutable=True, json_object=MySQLDatabaseConfigOptions
306315
),
316+
"private_network": Property(mutable=True, json_object=DatabasePrivateNetwork),
307317
}
308318

309319
@property
@@ -470,6 +480,7 @@ class PostgreSQLDatabase(Base):
470480
"engine_config": Property(
471481
mutable=True, json_object=PostgreSQLDatabaseConfigOptions
472482
),
483+
"private_network": Property(mutable=True, json_object=DatabasePrivateNetwork),
473484
}
474485

475486
@property
@@ -636,6 +647,7 @@ class Database(Base):
636647
"updated": Property(),
637648
"updates": Property(),
638649
"version": Property(),
650+
"private_network": Property(json_object=DatabasePrivateNetwork),
639651
}
640652

641653
@property

0 commit comments

Comments
 (0)