Skip to content

Commit 233a899

Browse files
Remove mongodb references (#279)
## πŸ“ Description Removing all MongoDB references in the codebase.
1 parent 3672869 commit 233a899

11 files changed

Lines changed: 2 additions & 478 deletions

β€Žlinode_api4/groups/database.pyβ€Ž

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
Database,
66
DatabaseEngine,
77
DatabaseType,
8-
MongoDBDatabase,
98
MySQLDatabase,
109
PostgreSQLDatabase,
1110
)
@@ -200,67 +199,3 @@ def postgresql_create(self, label, region, engine, ltype, **kwargs):
200199

201200
d = PostgreSQLDatabase(self.client, result["id"], result)
202201
return d
203-
204-
def mongodb_instances(self, *filters):
205-
"""
206-
Returns a list of Managed MongoDB Databases active on this account.
207-
208-
API Documentation: https://www.linode.com/docs/api/databases/#managed-mongodb-databases-list
209-
210-
:param filters: Any number of filters to apply to this query.
211-
212-
:returns: A list of MongoDB databases that matched the query.
213-
:rtype: PaginatedList of MongoDBDatabase
214-
"""
215-
return self.client._get_and_filter(MongoDBDatabase, *filters)
216-
217-
def mongodb_create(self, label, region, engine, ltype, **kwargs):
218-
"""
219-
Creates an :any:`MongoDBDatabase` on this account with
220-
the given label, region, engine, and node type. For example::
221-
222-
client = LinodeClient(TOKEN)
223-
224-
# look up Region and Types to use. In this example I'm just using
225-
# the first ones returned.
226-
region = client.regions().first()
227-
node_type = client.database.types()[0]
228-
engine = client.database.engines(DatabaseEngine.engine == 'mongodb')[0]
229-
230-
new_database = client.database.mongodb_create(
231-
"example-database",
232-
region,
233-
engine.id,
234-
type.id
235-
)
236-
237-
API Documentation: https://www.linode.com/docs/api/databases/#managed-mongodb-database-create
238-
239-
:param label: The name for this cluster
240-
:type label: str
241-
:param region: The region to deploy this cluster in
242-
:type region: str or Region
243-
:param engine: The engine to deploy this cluster with
244-
:type engine: str or Engine
245-
:param ltype: The Linode Type to use for this cluster
246-
:type ltype: str or Type
247-
"""
248-
249-
params = {
250-
"label": label,
251-
"region": region.id if issubclass(type(region), Base) else region,
252-
"engine": engine.id if issubclass(type(engine), Base) else engine,
253-
"type": ltype.id if issubclass(type(ltype), Base) else ltype,
254-
}
255-
params.update(kwargs)
256-
257-
result = self.client.post("/databases/mongodb/instances", data=params)
258-
259-
if "id" not in result:
260-
raise UnexpectedResponseError(
261-
"Unexpected response when creating MongoDB Database",
262-
json=result,
263-
)
264-
265-
d = MongoDBDatabase(self.client, result["id"], result)
266-
return d

β€Žlinode_api4/objects/database.pyβ€Ž

Lines changed: 0 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class DatabaseEngine(Base):
3939
4040
- MySQL
4141
- PostgreSQL
42-
- MongoDB
4342
4443
API Documentation: https://www.linode.com/docs/api/databases/#managed-database-engine-view
4544
"""
@@ -89,7 +88,6 @@ def restore(self):
8988
9089
API Documentation:
9190
92-
- MongoDB: https://www.linode.com/docs/api/databases/#managed-mongodb-database-backup-restore
9391
- MySQL: https://www.linode.com/docs/api/databases/#managed-mysql-database-backup-restore
9492
- PostgreSQL: https://www.linode.com/docs/api/databases/#managed-postgresql-database-backup-restore
9593
"""
@@ -109,16 +107,6 @@ class MySQLDatabaseBackup(DatabaseBackup):
109107
api_endpoint = "/databases/mysql/instances/{database_id}/backups/{id}"
110108

111109

112-
class MongoDBDatabaseBackup(DatabaseBackup):
113-
"""
114-
A backup for an accessible Managed MongoDB Database.
115-
116-
API Documentation: https://www.linode.com/docs/api/databases/#managed-mongodb-database-backup-view
117-
"""
118-
119-
api_endpoint = "/databases/mongodb/instances/{database_id}/backups/{id}"
120-
121-
122110
class PostgreSQLDatabaseBackup(DatabaseBackup):
123111
"""
124112
A backup for an accessible Managed PostgreSQL Database.
@@ -397,147 +385,9 @@ def invalidate(self):
397385
Base.invalidate(self)
398386

399387

400-
class MongoDBDatabase(Base):
401-
"""
402-
An accessible Managed MongoDB Database.
403-
404-
API Documentation: https://www.linode.com/docs/api/databases/#managed-mongodb-database-view
405-
"""
406-
407-
api_endpoint = "/databases/mongodb/instances/{id}"
408-
409-
properties = {
410-
"id": Property(identifier=True),
411-
"label": Property(mutable=True),
412-
"allow_list": Property(mutable=True),
413-
"backups": Property(derived_class=MongoDBDatabaseBackup),
414-
"cluster_size": Property(),
415-
"compression_type": Property(),
416-
"created": Property(is_datetime=True),
417-
"encrypted": Property(),
418-
"engine": Property(),
419-
"hosts": Property(),
420-
"peers": Property(),
421-
"port": Property(),
422-
"region": Property(),
423-
"replica_set": Property(),
424-
"ssl_connection": Property(),
425-
"status": Property(volatile=True),
426-
"storage_engine": Property(),
427-
"type": Property(),
428-
"updated": Property(volatile=True, is_datetime=True),
429-
"updates": Property(mutable=True),
430-
"version": Property(),
431-
}
432-
433-
@property
434-
def credentials(self):
435-
"""
436-
Display the root username and password for an accessible Managed MongoDB Database.
437-
The Database must have an active status to perform this command.
438-
439-
API Documentation: https://www.linode.com/docs/api/databases/#managed-mongodb-database-credentials-view
440-
441-
:returns: MappedObject containing credntials for this DB
442-
:rtype: MappedObject
443-
"""
444-
445-
if not hasattr(self, "_credentials"):
446-
resp = self._client.get(
447-
"{}/credentials".format(MongoDBDatabase.api_endpoint),
448-
model=self,
449-
)
450-
self._set("_credentials", MappedObject(**resp))
451-
452-
return self._credentials
453-
454-
@property
455-
def ssl(self):
456-
"""
457-
Display the SSL CA certificate for an accessible Managed MongoDB Database.
458-
459-
API Documentation: https://www.linode.com/docs/api/databases/#managed-mongodb-database-ssl-certificate-view
460-
461-
:returns: MappedObject containing SSL CA certificate for this DB
462-
:rtype: MappedObject
463-
"""
464-
465-
if not hasattr(self, "_ssl"):
466-
resp = self._client.get(
467-
"{}/ssl".format(MongoDBDatabase.api_endpoint), model=self
468-
)
469-
self._set("_ssl", MappedObject(**resp))
470-
471-
return self._ssl
472-
473-
def credentials_reset(self):
474-
"""
475-
Reset the root password for a Managed MongoDB Database.
476-
477-
API Documentation: https://www.linode.com/docs/api/databases/#managed-mongodb-database-credentials-reset
478-
479-
:returns: Response from the API call to reset credentials
480-
:rtype: dict
481-
"""
482-
483-
self.invalidate()
484-
485-
return self._client.post(
486-
"{}/credentials/reset".format(MongoDBDatabase.api_endpoint),
487-
model=self,
488-
)
489-
490-
def patch(self):
491-
"""
492-
Apply security patches and updates to the underlying operating system of the Managed MongoDB Database.
493-
494-
API Documentation: https://www.linode.com/docs/api/databases/#managed-mongodb-database-patch
495-
496-
:returns: Response from the API call to apply security patches
497-
:rtype: dict
498-
"""
499-
500-
self.invalidate()
501-
502-
return self._client.post(
503-
"{}/patch".format(MongoDBDatabase.api_endpoint), model=self
504-
)
505-
506-
def backup_create(self, label, **kwargs):
507-
"""
508-
Creates a snapshot backup of a Managed MongoDB Database.
509-
510-
API Documentation: https://www.linode.com/docs/api/databases/#managed-mongodb-database-backup-snapshot-create
511-
"""
512-
513-
params = {
514-
"label": label,
515-
}
516-
params.update(kwargs)
517-
518-
self._client.post(
519-
"{}/backups".format(MongoDBDatabase.api_endpoint),
520-
model=self,
521-
data=params,
522-
)
523-
self.invalidate()
524-
525-
def invalidate(self):
526-
"""
527-
Clear out cached properties.
528-
"""
529-
530-
for attr in ["_ssl", "_credentials"]:
531-
if hasattr(self, attr):
532-
delattr(self, attr)
533-
534-
Base.invalidate(self)
535-
536-
537388
ENGINE_TYPE_TRANSLATION = {
538389
"mysql": MySQLDatabase,
539390
"postgresql": PostgreSQLDatabase,
540-
"mongodb": MongoDBDatabase,
541391
}
542392

543393

β€Žtest/fixtures/databases_mongodb_instances.jsonβ€Ž

Lines changed: 0 additions & 45 deletions
This file was deleted.

β€Žtest/fixtures/databases_mongodb_instances_123_backups.jsonβ€Ž

Lines changed: 0 additions & 13 deletions
This file was deleted.

β€Žtest/fixtures/databases_mongodb_instances_123_backups_456_restore.jsonβ€Ž

Lines changed: 0 additions & 1 deletion
This file was deleted.

β€Žtest/fixtures/databases_mongodb_instances_123_credentials.jsonβ€Ž

Lines changed: 0 additions & 4 deletions
This file was deleted.

β€Žtest/fixtures/databases_mongodb_instances_123_credentials_reset.jsonβ€Ž

Lines changed: 0 additions & 1 deletion
This file was deleted.

β€Žtest/fixtures/databases_mongodb_instances_123_patch.jsonβ€Ž

Lines changed: 0 additions & 1 deletion
This file was deleted.

β€Žtest/fixtures/databases_mongodb_instances_123_ssl.jsonβ€Ž

Lines changed: 0 additions & 3 deletions
This file was deleted.

β€Žtest/fixtures/databases_types.jsonβ€Ž

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
"deprecated": false,
66
"disk": 25600,
77
"engines": {
8-
"mongodb": [
9-
{
10-
"price": {
11-
"hourly": 0.03,
12-
"monthly": 20
13-
},
14-
"quantity": 1
15-
}
16-
],
178
"mysql": [
189
{
1910
"price": {

0 commit comments

Comments
Β (0)