@@ -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-
122110class 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-
537388ENGINE_TYPE_TRANSLATION = {
538389 "mysql" : MySQLDatabase ,
539390 "postgresql" : PostgreSQLDatabase ,
540- "mongodb" : MongoDBDatabase ,
541391}
542392
543393
0 commit comments