|
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\Domains; |
|
13
|
|
|
|
|
14
|
|
|
use Linode\Domains\Repository\DomainRecordRepository; |
|
15
|
|
|
use Linode\Entity; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* A domain zonefile in our DNS system. You must own the domain name and tell your |
|
19
|
|
|
* registrar to use Linode's nameservers in order for a domain in our system to be |
|
20
|
|
|
* treated as authoritative. |
|
21
|
|
|
* |
|
22
|
|
|
* @property int $id This Domain's unique ID |
|
23
|
|
|
* @property string $domain The domain this Domain represents. Domain labels cannot be longer than 63 |
|
24
|
|
|
* characters and must conform to RFC1035. Domains must be unique on Linode's |
|
25
|
|
|
* platform, including across different Linode accounts; there cannot be two Domains |
|
26
|
|
|
* representing the same domain. |
|
27
|
|
|
* @property string $type If this Domain represents the authoritative source of information for the domain |
|
28
|
|
|
* it describes, or if it is a read-only copy of a master (also called a slave). |
|
29
|
|
|
* @property string $status Used to control whether this Domain is currently being rendered. |
|
30
|
|
|
* @property string $soa_email Start of Authority email address. This is required for master Domains. |
|
31
|
|
|
* @property string $group The group this Domain belongs to. This is for display purposes only. |
|
32
|
|
|
* @property string $description A description for this Domain. This is for display purposes only. |
|
33
|
|
|
* @property int $ttl_sec "Time to Live" - the amount of time in seconds that this Domain's records may be |
|
34
|
|
|
* cached by resolvers or other domain servers. |
|
35
|
|
|
* * Valid values are 0, 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, |
|
36
|
|
|
* 604800, 1209600, and 2419200 - any other value will be rounded to the nearest |
|
37
|
|
|
* valid value. |
|
38
|
|
|
* * ttl_sec will default to 0 if no value is provided. |
|
39
|
|
|
* * A value of 0 is equivalent to a value of 86400. |
|
40
|
|
|
* @property int $refresh_sec The amount of time in seconds before this Domain should be refreshed. Valid values |
|
41
|
|
|
* are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, 1209600, |
|
42
|
|
|
* and 2419200 - any other value will be rounded to the nearest valid value. |
|
43
|
|
|
* @property int $retry_sec The interval, in seconds, at which a failed refresh should be retried. Valid |
|
44
|
|
|
* values are 300, 3600, 7200, 14400, 28800, 57600, 86400, 172800, 345600, 604800, |
|
45
|
|
|
* 1209600, and 2419200 - any other value will be rounded to the nearest valid value. |
|
46
|
|
|
* @property int $expire_sec The amount of time in seconds that may pass before this Domain is no longer |
|
47
|
|
|
* authoritative. Valid values are 300, 3600, 7200, 14400, 28800, 57600, 86400, |
|
48
|
|
|
* 172800, 345600, 604800, 1209600, and 2419200 - any other value will be rounded to |
|
49
|
|
|
* the nearest valid value. |
|
50
|
|
|
* @property string[] $master_ips The IP addresses representing the master DNS for this Domain. |
|
51
|
|
|
* @property string[] $axfr_ips The list of IPs that may perform a zone transfer for this Domain. This is |
|
52
|
|
|
* potentially dangerous, and should be set to an empty list unless you intend to use |
|
53
|
|
|
* it. |
|
54
|
|
|
* @property string[] $tags An array of tags applied to this object. Tags are for organizational purposes |
|
55
|
|
|
* only. |
|
56
|
|
|
* @property DomainRecordRepositoryInterface $records Domain records. |
|
57
|
|
|
*/ |
|
58
|
|
|
class Domain extends Entity |
|
59
|
|
|
{ |
|
60
|
|
|
// Available fields. |
|
61
|
|
|
public const FIELD_ID = 'id'; |
|
62
|
|
|
public const FIELD_DOMAIN = 'domain'; |
|
63
|
|
|
public const FIELD_TYPE = 'type'; |
|
64
|
|
|
public const FIELD_STATUS = 'status'; |
|
65
|
|
|
public const FIELD_SOA_EMAIL = 'soa_email'; |
|
66
|
|
|
public const FIELD_GROUP = 'group'; |
|
67
|
|
|
public const FIELD_DESCRIPTION = 'description'; |
|
68
|
|
|
public const FIELD_TTL_SEC = 'ttl_sec'; |
|
69
|
|
|
public const FIELD_REFRESH_SEC = 'refresh_sec'; |
|
70
|
|
|
public const FIELD_RETRY_SEC = 'retry_sec'; |
|
71
|
|
|
public const FIELD_EXPIRE_SEC = 'expire_sec'; |
|
72
|
|
|
public const FIELD_MASTER_IPS = 'master_ips'; |
|
73
|
|
|
public const FIELD_AXFR_IPS = 'axfr_ips'; |
|
74
|
|
|
public const FIELD_TAGS = 'tags'; |
|
75
|
|
|
|
|
76
|
|
|
// `FIELD_TYPE` values. |
|
77
|
|
|
public const TYPE_MASTER = 'master'; |
|
78
|
|
|
public const TYPE_SLAVE = 'slave'; |
|
79
|
|
|
|
|
80
|
|
|
// `FIELD_STATUS` values. |
|
81
|
|
|
public const STATUS_DISABLED = 'disabled'; |
|
82
|
|
|
public const STATUS_ACTIVE = 'active'; |
|
83
|
|
|
public const STATUS_EDIT_MODE = 'edit_mode'; |
|
84
|
|
|
public const STATUS_HAS_ERRORS = 'has_errors'; |
|
85
|
|
|
|
|
86
|
|
|
// Time values. |
|
87
|
|
|
public const TIME_DEFAULT = 0; |
|
88
|
|
|
public const TIME_5_MINS = 300; |
|
89
|
|
|
public const TIME_1_HOUR = 3600; |
|
90
|
|
|
public const TIME_2_HOURS = 7200; |
|
91
|
|
|
public const TIME_4_HOURS = 14400; |
|
92
|
|
|
public const TIME_8_HOURS = 28800; |
|
93
|
|
|
public const TIME_16_HOURS = 57600; |
|
94
|
|
|
public const TIME_1_DAY = 86400; |
|
95
|
|
|
public const TIME_2_DAYS = 172800; |
|
96
|
|
|
public const TIME_4_DAYS = 345600; |
|
97
|
|
|
public const TIME_1_WEEK = 604800; |
|
98
|
|
|
public const TIME_2_WEEKS = 1209600; |
|
99
|
|
|
public const TIME_4_WEEKS = 2419200; |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* @codeCoverageIgnore This method was autogenerated. |
|
103
|
|
|
*/ |
|
104
|
|
|
public function __get(string $name): mixed |
|
105
|
|
|
{ |
|
106
|
|
|
return match ($name) { |
|
107
|
|
|
'records' => new DomainRecordRepository($this->client, $this->id), |
|
108
|
|
|
default => parent::__get($name), |
|
109
|
|
|
}; |
|
110
|
|
|
} |
|
111
|
|
|
} |
|
112
|
|
|
|