|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
// --------------------------------------------------------------------- |
|
4
|
|
|
// |
|
5
|
|
|
// Copyright (C) 2018-2024 Artem Rodygin |
|
6
|
|
|
// |
|
7
|
|
|
// You should have received a copy of the MIT License along with |
|
8
|
|
|
// this file. If not, see <https://opensource.org/licenses/MIT>. |
|
9
|
|
|
// |
|
10
|
|
|
// --------------------------------------------------------------------- |
|
11
|
|
|
|
|
12
|
|
|
namespace Linode\Databases; |
|
13
|
|
|
|
|
14
|
|
|
use Linode\Entity; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Managed PostgreSQL Databases object. |
|
18
|
|
|
* |
|
19
|
|
|
* @property int $id A unique ID that can be used to identify and reference the Managed Database. |
|
20
|
|
|
* @property string $label A unique, user-defined string referring to the Managed Database. |
|
21
|
|
|
* @property string $region The Region ID for the Managed Database. |
|
22
|
|
|
* @property string $type The Linode Instance type used by the Managed Database for its nodes. |
|
23
|
|
|
* @property int $cluster_size The number of Linode Instance nodes deployed to the Managed Database. |
|
24
|
|
|
* Choosing 3 nodes creates a high availability cluster consisting of 1 primary node |
|
25
|
|
|
* and 2 replica nodes. |
|
26
|
|
|
* @property string $engine The Managed Database engine type. |
|
27
|
|
|
* @property string $version The Managed Database engine version. |
|
28
|
|
|
* @property int $total_disk_size_gb The total disk size of the database in GB. |
|
29
|
|
|
* @property int $used_disk_size_gb The used space of the database in GB. |
|
30
|
|
|
* @property int $port The access port for this Managed Database. |
|
31
|
|
|
* @property string $replication_type The replication method used for the Managed Database. |
|
32
|
|
|
* Defaults to `none` for a single cluster and `asynch` for a high availability |
|
33
|
|
|
* cluster. |
|
34
|
|
|
* Must be `none` for a single node cluster. |
|
35
|
|
|
* Must be `asynch` for a high availability cluster. |
|
36
|
|
|
* @property string $status The operating status of the Managed Database. |
|
37
|
|
|
* @property string $replication_commit_type The synchronization level of the replicating server. |
|
38
|
|
|
* Must be `local` or `off` for the `asynch` replication type. |
|
39
|
|
|
* @property bool $encrypted Whether the Managed Databases is encrypted. |
|
40
|
|
|
* @property string[] $allow_list A list of IP addresses that can access the Managed Database. Each item can be a |
|
41
|
|
|
* single IP address or a range in CIDR format. |
|
42
|
|
|
* By default, this is an empty array (`[]`), which blocks all connections (both |
|
43
|
|
|
* public and private) to the Managed Database. |
|
44
|
|
|
* If `0.0.0.0/0` is a value in this list, then all IP addresses can access the |
|
45
|
|
|
* Managed Database. |
|
46
|
|
|
* @property DatabaseHosts $hosts The primary and secondary hosts for the Managed Database. These are assigned after |
|
47
|
|
|
* provisioning is complete. |
|
48
|
|
|
* @property bool $ssl_connection Whether to require SSL credentials to establish a connection to the Managed |
|
49
|
|
|
* Database. |
|
50
|
|
|
* Use the **Managed PostgreSQL Database Credentials View** (GET |
|
51
|
|
|
* /databases/postgresql/instances/{instanceId}/credentials) command for access |
|
52
|
|
|
* information. |
|
53
|
|
|
* @property string $created When this Managed Database was created. |
|
54
|
|
|
* @property string $updated When this Managed Database was last updated. |
|
55
|
|
|
* @property DatabaseUpdates $updates Configuration settings for automated patch update maintenance for the Managed |
|
56
|
|
|
* Database. |
|
57
|
|
|
*/ |
|
58
|
|
|
class DatabasePostgreSQL extends Entity |
|
59
|
|
|
{ |
|
60
|
|
|
// Available fields. |
|
61
|
|
|
public const FIELD_ID = 'id'; |
|
62
|
|
|
public const FIELD_LABEL = 'label'; |
|
63
|
|
|
public const FIELD_REGION = 'region'; |
|
64
|
|
|
public const FIELD_TYPE = 'type'; |
|
65
|
|
|
public const FIELD_CLUSTER_SIZE = 'cluster_size'; |
|
66
|
|
|
public const FIELD_ENGINE = 'engine'; |
|
67
|
|
|
public const FIELD_VERSION = 'version'; |
|
68
|
|
|
public const FIELD_TOTAL_DISK_SIZE_GB = 'total_disk_size_gb'; |
|
69
|
|
|
public const FIELD_USED_DISK_SIZE_GB = 'used_disk_size_gb'; |
|
70
|
|
|
public const FIELD_PORT = 'port'; |
|
71
|
|
|
public const FIELD_REPLICATION_TYPE = 'replication_type'; |
|
72
|
|
|
public const FIELD_STATUS = 'status'; |
|
73
|
|
|
public const FIELD_REPLICATION_COMMIT_TYPE = 'replication_commit_type'; |
|
74
|
|
|
public const FIELD_ENCRYPTED = 'encrypted'; |
|
75
|
|
|
public const FIELD_ALLOW_LIST = 'allow_list'; |
|
76
|
|
|
public const FIELD_HOSTS = 'hosts'; |
|
77
|
|
|
public const FIELD_SSL_CONNECTION = 'ssl_connection'; |
|
78
|
|
|
public const FIELD_CREATED = 'created'; |
|
79
|
|
|
public const FIELD_UPDATED = 'updated'; |
|
80
|
|
|
public const FIELD_UPDATES = 'updates'; |
|
81
|
|
|
|
|
82
|
|
|
// `FIELD_CLUSTER_SIZE` values. |
|
83
|
|
|
public const CLUSTER_SIZE_1 = 1; |
|
84
|
|
|
public const CLUSTER_SIZE_3 = 3; |
|
85
|
|
|
|
|
86
|
|
|
// `FIELD_REPLICATION_TYPE` values. |
|
87
|
|
|
public const REPLICATION_TYPE_NONE = 'none'; |
|
88
|
|
|
public const REPLICATION_TYPE_ASYNCH = 'asynch'; |
|
89
|
|
|
|
|
90
|
|
|
// `FIELD_STATUS` values. |
|
91
|
|
|
public const STATUS_PROVISIONING = 'provisioning'; |
|
92
|
|
|
public const STATUS_ACTIVE = 'active'; |
|
93
|
|
|
public const STATUS_SUSPENDING = 'suspending'; |
|
94
|
|
|
public const STATUS_SUSPENDED = 'suspended'; |
|
95
|
|
|
public const STATUS_RESUMING = 'resuming'; |
|
96
|
|
|
public const STATUS_RESTORING = 'restoring'; |
|
97
|
|
|
public const STATUS_FAILED = 'failed'; |
|
98
|
|
|
public const STATUS_DEGRADED = 'degraded'; |
|
99
|
|
|
public const STATUS_UPDATING = 'updating'; |
|
100
|
|
|
public const STATUS_BACKING_UP = 'backing_up'; |
|
101
|
|
|
|
|
102
|
|
|
// `FIELD_REPLICATION_COMMIT_TYPE` values. |
|
103
|
|
|
public const REPLICATION_COMMIT_TYPE_ON = 'on'; |
|
104
|
|
|
public const REPLICATION_COMMIT_TYPE_LOCAL = 'local'; |
|
105
|
|
|
public const REPLICATION_COMMIT_TYPE_REMOTE_WRITE = 'remote_write'; |
|
106
|
|
|
public const REPLICATION_COMMIT_TYPE_REMOTE_APPLY = 'remote_apply'; |
|
107
|
|
|
public const REPLICATION_COMMIT_TYPE_OFF = 'off'; |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* @codeCoverageIgnore This method was autogenerated. |
|
111
|
|
|
*/ |
|
112
|
|
|
public function __get(string $name): mixed |
|
113
|
|
|
{ |
|
114
|
|
|
return match ($name) { |
|
115
|
|
|
self::FIELD_HOSTS => new DatabaseHosts($this->client, $this->data[$name]), |
|
116
|
|
|
self::FIELD_UPDATES => new DatabaseUpdates($this->client, $this->data[$name]), |
|
117
|
|
|
default => parent::__get($name), |
|
118
|
|
|
}; |
|
119
|
|
|
} |
|
120
|
|
|
} |
|
121
|
|
|
|