|
1 | 1 | from dataclasses import dataclass, field |
2 | 2 | from typing import Optional |
3 | 3 |
|
4 | | -from deprecated import deprecated |
5 | | - |
6 | 4 | from linode_api4.objects import ( |
7 | 5 | Base, |
8 | | - DerivedBase, |
9 | 6 | JSONObject, |
10 | 7 | MappedObject, |
11 | 8 | Property, |
@@ -86,69 +83,6 @@ class DatabasePrivateNetwork(JSONObject): |
86 | 83 | public_access: Optional[bool] = None |
87 | 84 |
|
88 | 85 |
|
89 | | -@deprecated( |
90 | | - reason="Backups are not supported for non-legacy database clusters." |
91 | | -) |
92 | | -class DatabaseBackup(DerivedBase): |
93 | | - """ |
94 | | - A generic Managed Database backup. |
95 | | -
|
96 | | - This class is not intended to be used on its own. |
97 | | - Use the appropriate subclasses for the corresponding database engine. (e.g. MySQLDatabaseBackup) |
98 | | - """ |
99 | | - |
100 | | - api_endpoint = "" |
101 | | - derived_url_path = "backups" |
102 | | - parent_id_name = "database_id" |
103 | | - |
104 | | - properties = { |
105 | | - "created": Property(is_datetime=True), |
106 | | - "id": Property(identifier=True), |
107 | | - "label": Property(), |
108 | | - "type": Property(), |
109 | | - } |
110 | | - |
111 | | - def restore(self): |
112 | | - """ |
113 | | - Restore a backup to a Managed Database on your Account. |
114 | | -
|
115 | | - API Documentation: |
116 | | -
|
117 | | - - MySQL: https://techdocs.akamai.com/linode-api/reference/post-databases-mysql-instance-backup-restore |
118 | | - - PostgreSQL: https://techdocs.akamai.com/linode-api/reference/post-databases-postgre-sql-instance-backup-restore |
119 | | - """ |
120 | | - |
121 | | - return self._client.post( |
122 | | - "{}/restore".format(self.api_endpoint), model=self |
123 | | - ) |
124 | | - |
125 | | - |
126 | | -@deprecated( |
127 | | - reason="Backups are not supported for non-legacy database clusters." |
128 | | -) |
129 | | -class MySQLDatabaseBackup(DatabaseBackup): |
130 | | - """ |
131 | | - A backup for an accessible Managed MySQL Database. |
132 | | -
|
133 | | - API Documentation: https://techdocs.akamai.com/linode-api/reference/get-databases-mysql-instance-backup |
134 | | - """ |
135 | | - |
136 | | - api_endpoint = "/databases/mysql/instances/{database_id}/backups/{id}" |
137 | | - |
138 | | - |
139 | | -@deprecated( |
140 | | - reason="Backups are not supported for non-legacy database clusters." |
141 | | -) |
142 | | -class PostgreSQLDatabaseBackup(DatabaseBackup): |
143 | | - """ |
144 | | - A backup for an accessible Managed PostgreSQL Database. |
145 | | -
|
146 | | - API Documentation: https://techdocs.akamai.com/linode-api/reference/get-databases-postgresql-instance-backup |
147 | | - """ |
148 | | - |
149 | | - api_endpoint = "/databases/postgresql/instances/{database_id}/backups/{id}" |
150 | | - |
151 | | - |
152 | 86 | @dataclass |
153 | 87 | class MySQLDatabaseConfigMySQLOptions(JSONObject): |
154 | 88 | """ |
@@ -296,15 +230,13 @@ class MySQLDatabase(Base): |
296 | 230 | "id": Property(identifier=True), |
297 | 231 | "label": Property(mutable=True), |
298 | 232 | "allow_list": Property(mutable=True, unordered=True), |
299 | | - "backups": Property(derived_class=MySQLDatabaseBackup), |
300 | 233 | "cluster_size": Property(mutable=True), |
301 | 234 | "created": Property(is_datetime=True), |
302 | 235 | "encrypted": Property(), |
303 | 236 | "engine": Property(), |
304 | 237 | "hosts": Property(), |
305 | 238 | "port": Property(), |
306 | 239 | "region": Property(), |
307 | | - "replication_type": Property(), |
308 | 240 | "ssl_connection": Property(), |
309 | 241 | "status": Property(volatile=True), |
310 | 242 | "type": Property(mutable=True), |
@@ -393,28 +325,6 @@ def patch(self): |
393 | 325 | "{}/patch".format(MySQLDatabase.api_endpoint), model=self |
394 | 326 | ) |
395 | 327 |
|
396 | | - @deprecated( |
397 | | - reason="Backups are not supported for non-legacy database clusters." |
398 | | - ) |
399 | | - def backup_create(self, label, **kwargs): |
400 | | - """ |
401 | | - Creates a snapshot backup of a Managed MySQL Database. |
402 | | -
|
403 | | - API Documentation: https://techdocs.akamai.com/linode-api/reference/post-databases-mysql-instance-backup |
404 | | - """ |
405 | | - |
406 | | - params = { |
407 | | - "label": label, |
408 | | - } |
409 | | - params.update(kwargs) |
410 | | - |
411 | | - self._client.post( |
412 | | - "{}/backups".format(MySQLDatabase.api_endpoint), |
413 | | - model=self, |
414 | | - data=params, |
415 | | - ) |
416 | | - self.invalidate() |
417 | | - |
418 | 328 | def invalidate(self): |
419 | 329 | """ |
420 | 330 | Clear out cached properties. |
@@ -464,16 +374,13 @@ class PostgreSQLDatabase(Base): |
464 | 374 | "id": Property(identifier=True), |
465 | 375 | "label": Property(mutable=True), |
466 | 376 | "allow_list": Property(mutable=True, unordered=True), |
467 | | - "backups": Property(derived_class=PostgreSQLDatabaseBackup), |
468 | 377 | "cluster_size": Property(mutable=True), |
469 | 378 | "created": Property(is_datetime=True), |
470 | 379 | "encrypted": Property(), |
471 | 380 | "engine": Property(), |
472 | 381 | "hosts": Property(), |
473 | 382 | "port": Property(), |
474 | 383 | "region": Property(), |
475 | | - "replication_commit_type": Property(), |
476 | | - "replication_type": Property(), |
477 | 384 | "ssl_connection": Property(), |
478 | 385 | "status": Property(volatile=True), |
479 | 386 | "type": Property(mutable=True), |
@@ -563,28 +470,6 @@ def patch(self): |
563 | 470 | "{}/patch".format(PostgreSQLDatabase.api_endpoint), model=self |
564 | 471 | ) |
565 | 472 |
|
566 | | - @deprecated( |
567 | | - reason="Backups are not supported for non-legacy database clusters." |
568 | | - ) |
569 | | - def backup_create(self, label, **kwargs): |
570 | | - """ |
571 | | - Creates a snapshot backup of a Managed PostgreSQL Database. |
572 | | -
|
573 | | - API Documentation: https://techdocs.akamai.com/linode-api/reference/post-databases-postgre-sql-instance-backup |
574 | | - """ |
575 | | - |
576 | | - params = { |
577 | | - "label": label, |
578 | | - } |
579 | | - params.update(kwargs) |
580 | | - |
581 | | - self._client.post( |
582 | | - "{}/backups".format(PostgreSQLDatabase.api_endpoint), |
583 | | - model=self, |
584 | | - data=params, |
585 | | - ) |
586 | | - self.invalidate() |
587 | | - |
588 | 473 | def invalidate(self): |
589 | 474 | """ |
590 | 475 | Clear out cached properties. |
|
0 commit comments