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 $port The access port for this Managed Database. |
29
|
|
|
* @property string $replication_type The replication method used for the Managed Database. |
30
|
|
|
* Defaults to `none` for a single cluster and `asynch` for a high availability |
31
|
|
|
* cluster. |
32
|
|
|
* Must be `none` for a single node cluster. |
33
|
|
|
* Must be `asynch` for a high availability cluster. |
34
|
|
|
* @property string $status The operating status of the Managed Database. |
35
|
|
|
* @property string $replication_commit_type The synchronization level of the replicating server. |
36
|
|
|
* Must be `local` or `off` for the `asynch` replication type. |
37
|
|
|
* @property bool $encrypted Whether the Managed Databases is encrypted. |
38
|
|
|
* @property string[] $allow_list A list of IP addresses that can access the Managed Database. Each item can be a |
39
|
|
|
* single IP address or a range in CIDR format. |
40
|
|
|
* By default, this is an empty array (`[]`), which blocks all connections (both |
41
|
|
|
* public and private) to the Managed Database. |
42
|
|
|
* If `0.0.0.0/0` is a value in this list, then all IP addresses can access the |
43
|
|
|
* Managed Database. |
44
|
|
|
* @property DatabaseHosts $hosts The primary and secondary hosts for the Managed Database. These are assigned after |
45
|
|
|
* provisioning is complete. |
46
|
|
|
* @property bool $ssl_connection Whether to require SSL credentials to establish a connection to the Managed |
47
|
|
|
* Database. |
48
|
|
|
* Use the **Managed PostgreSQL Database Credentials View** (GET |
49
|
|
|
* /databases/postgresql/instances/{instanceId}/credentials) command for access |
50
|
|
|
* information. |
51
|
|
|
* @property string $created When this Managed Database was created. |
52
|
|
|
* @property string $updated When this Managed Database was last updated. |
53
|
|
|
* @property DatabaseUpdates $updates Configuration settings for automated patch update maintenance for the Managed |
54
|
|
|
* Database. |
55
|
|
|
*/ |
56
|
|
|
class DatabasePostgreSQL extends Entity |
57
|
|
|
{ |
58
|
|
|
// Available fields. |
59
|
|
|
public const FIELD_ID = 'id'; |
60
|
|
|
public const FIELD_LABEL = 'label'; |
61
|
|
|
public const FIELD_REGION = 'region'; |
62
|
|
|
public const FIELD_TYPE = 'type'; |
63
|
|
|
public const FIELD_CLUSTER_SIZE = 'cluster_size'; |
64
|
|
|
public const FIELD_ENGINE = 'engine'; |
65
|
|
|
public const FIELD_VERSION = 'version'; |
66
|
|
|
public const FIELD_PORT = 'port'; |
67
|
|
|
public const FIELD_REPLICATION_TYPE = 'replication_type'; |
68
|
|
|
public const FIELD_STATUS = 'status'; |
69
|
|
|
public const FIELD_REPLICATION_COMMIT_TYPE = 'replication_commit_type'; |
70
|
|
|
public const FIELD_ENCRYPTED = 'encrypted'; |
71
|
|
|
public const FIELD_ALLOW_LIST = 'allow_list'; |
72
|
|
|
public const FIELD_HOSTS = 'hosts'; |
73
|
|
|
public const FIELD_SSL_CONNECTION = 'ssl_connection'; |
74
|
|
|
public const FIELD_CREATED = 'created'; |
75
|
|
|
public const FIELD_UPDATED = 'updated'; |
76
|
|
|
public const FIELD_UPDATES = 'updates'; |
77
|
|
|
|
78
|
|
|
// `FIELD_CLUSTER_SIZE` values. |
79
|
|
|
public const CLUSTER_SIZE_1 = 1; |
80
|
|
|
public const CLUSTER_SIZE_3 = 3; |
81
|
|
|
|
82
|
|
|
// `FIELD_REPLICATION_TYPE` values. |
83
|
|
|
public const REPLICATION_TYPE_NONE = 'none'; |
84
|
|
|
public const REPLICATION_TYPE_ASYNCH = 'asynch'; |
85
|
|
|
|
86
|
|
|
// `FIELD_STATUS` values. |
87
|
|
|
public const STATUS_PROVISIONING = 'provisioning'; |
88
|
|
|
public const STATUS_ACTIVE = 'active'; |
89
|
|
|
public const STATUS_SUSPENDING = 'suspending'; |
90
|
|
|
public const STATUS_SUSPENDED = 'suspended'; |
91
|
|
|
public const STATUS_RESUMING = 'resuming'; |
92
|
|
|
public const STATUS_RESTORING = 'restoring'; |
93
|
|
|
public const STATUS_FAILED = 'failed'; |
94
|
|
|
public const STATUS_DEGRADED = 'degraded'; |
95
|
|
|
public const STATUS_UPDATING = 'updating'; |
96
|
|
|
public const STATUS_BACKING_UP = 'backing_up'; |
97
|
|
|
|
98
|
|
|
// `FIELD_REPLICATION_COMMIT_TYPE` values. |
99
|
|
|
public const REPLICATION_COMMIT_TYPE_ON = 'on'; |
100
|
|
|
public const REPLICATION_COMMIT_TYPE_LOCAL = 'local'; |
101
|
|
|
public const REPLICATION_COMMIT_TYPE_REMOTE_WRITE = 'remote_write'; |
102
|
|
|
public const REPLICATION_COMMIT_TYPE_REMOTE_APPLY = 'remote_apply'; |
103
|
|
|
public const REPLICATION_COMMIT_TYPE_OFF = 'off'; |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @codeCoverageIgnore This method was autogenerated. |
107
|
|
|
*/ |
108
|
|
|
public function __get(string $name): mixed |
109
|
|
|
{ |
110
|
|
|
return match ($name) { |
111
|
|
|
self::FIELD_HOSTS => new DatabaseHosts($this->client, $this->data[$name]), |
112
|
|
|
self::FIELD_UPDATES => new DatabaseUpdates($this->client, $this->data[$name]), |
113
|
|
|
default => parent::__get($name), |
114
|
|
|
}; |
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|