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\Account; |
13
|
|
|
|
14
|
|
|
use Linode\Entity; |
15
|
|
|
use Linode\Linode\LinodeEntity; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* A collection of Event objects. An Event is an action taken against an entity |
19
|
|
|
* related to your Account. For example, booting a Linode would create an Event. |
20
|
|
|
* The Events returned depends on your grants. |
21
|
|
|
* |
22
|
|
|
* @property int $id The unique ID of this Event. |
23
|
|
|
* @property string $username The username of the User who caused the Event. |
24
|
|
|
* @property string $action The action that caused this Event. New actions may be added in the future. |
25
|
|
|
* @property LinodeEntity $entity Detailed information about the Event's entity, including ID, type, label, and URL |
26
|
|
|
* used to access it. |
27
|
|
|
* @property string $created When this Event was created. |
28
|
|
|
* @property string $status The current status of this Event. |
29
|
|
|
* @property bool $seen If this Event has been seen. |
30
|
|
|
* @property bool $read If this Event has been read. |
31
|
|
|
* @property string $rate The rate of completion of the Event. Only some Events will return rate; for |
32
|
|
|
* example, migration and resize Events. |
33
|
|
|
* @property int $percent_complete A percentage estimating the amount of time remaining for an Event. |
34
|
|
|
* Returns `null` for notification events. |
35
|
|
|
* @property null|string $time_remaining The estimated time remaining until the completion of this Event. This value is |
36
|
|
|
* only returned for some in-progress migration events. For all other in-progress |
37
|
|
|
* events, the `percent_complete` attribute will indicate about how much more work is |
38
|
|
|
* to be done. |
39
|
|
|
*/ |
40
|
|
|
class Event extends Entity |
41
|
|
|
{ |
42
|
|
|
// Available fields. |
43
|
|
|
public const FIELD_ID = 'id'; |
44
|
|
|
public const FIELD_USERNAME = 'username'; |
45
|
|
|
public const FIELD_ACTION = 'action'; |
46
|
|
|
public const FIELD_ENTITY = 'entity'; |
47
|
|
|
public const FIELD_CREATED = 'created'; |
48
|
|
|
public const FIELD_STATUS = 'status'; |
49
|
|
|
public const FIELD_SEEN = 'seen'; |
50
|
|
|
public const FIELD_READ = 'read'; |
51
|
|
|
public const FIELD_RATE = 'rate'; |
52
|
|
|
public const FIELD_PERCENT_COMPLETE = 'percent_complete'; |
53
|
|
|
public const FIELD_TIME_REMAINING = 'time_remaining'; |
54
|
|
|
|
55
|
|
|
// `FIELD_ACTION` values. |
56
|
|
|
public const ACTION_ACCOUNT_UPDATE = 'account_update'; |
57
|
|
|
public const ACTION_ACCOUNT_SETTINGS_UPDATE = 'account_settings_update'; |
58
|
|
|
public const ACTION_BACKUPS_ENABLE = 'backups_enable'; |
59
|
|
|
public const ACTION_BACKUPS_CANCEL = 'backups_cancel'; |
60
|
|
|
public const ACTION_BACKUPS_RESTORE = 'backups_restore'; |
61
|
|
|
public const ACTION_COMMUNITY_QUESTION_REPLY = 'community_question_reply'; |
62
|
|
|
public const ACTION_COMMUNITY_LIKE = 'community_like'; |
63
|
|
|
public const ACTION_CREDIT_CARD_UPDATED = 'credit_card_updated'; |
64
|
|
|
public const ACTION_DISK_CREATE = 'disk_create'; |
65
|
|
|
public const ACTION_DISK_DELETE = 'disk_delete'; |
66
|
|
|
public const ACTION_DISK_UPDATE = 'disk_update'; |
67
|
|
|
public const ACTION_DISK_DUPLICATE = 'disk_duplicate'; |
68
|
|
|
public const ACTION_DISK_IMAGIZE = 'disk_imagize'; |
69
|
|
|
public const ACTION_DISK_RESIZE = 'disk_resize'; |
70
|
|
|
public const ACTION_DNS_RECORD_CREATE = 'dns_record_create'; |
71
|
|
|
public const ACTION_DNS_RECORD_DELETE = 'dns_record_delete'; |
72
|
|
|
public const ACTION_DNS_RECORD_UPDATE = 'dns_record_update'; |
73
|
|
|
public const ACTION_DNS_ZONE_CREATE = 'dns_zone_create'; |
74
|
|
|
public const ACTION_DNS_ZONE_DELETE = 'dns_zone_delete'; |
75
|
|
|
public const ACTION_DNS_ZONE_IMPORT = 'dnz_zone_import'; |
76
|
|
|
public const ACTION_DNS_ZONE_UPDATE = 'dns_zone_update'; |
77
|
|
|
public const ACTION_HOST_REBOOT = 'host_reboot'; |
78
|
|
|
public const ACTION_IMAGE_DELETE = 'image_delete'; |
79
|
|
|
public const ACTION_IMAGE_UPDATE = 'image_update'; |
80
|
|
|
public const ACTION_IPADDRESS_UPDATE = 'ipaddress_update'; |
81
|
|
|
public const ACTION_LASSIE_REBOOT = 'lassie_reboot'; |
82
|
|
|
public const ACTION_LISH_BOOT = 'lish_boot'; |
83
|
|
|
public const ACTION_LINODE_ADDIP = 'linode_addip'; |
84
|
|
|
public const ACTION_LINODE_BOOT = 'linode_boot'; |
85
|
|
|
public const ACTION_LINODE_CLONE = 'linode_clone'; |
86
|
|
|
public const ACTION_LINODE_CREATE = 'linode_create'; |
87
|
|
|
public const ACTION_LINODE_DELETE = 'linode_delete'; |
88
|
|
|
public const ACTION_LINODE_UPDATE = 'linode_update'; |
89
|
|
|
public const ACTION_LINODE_DELETEIP = 'linode_deleteip'; |
90
|
|
|
public const ACTION_LINODE_MIGRATE = 'linode_migrate'; |
91
|
|
|
public const ACTION_LINODE_MIGRATE_DATACENTER = 'linode_migrate_datacenter'; |
92
|
|
|
public const ACTION_LINODE_MIGRATE_DATACENTER_CREATE = 'linode_migrate_datacenter_create'; |
93
|
|
|
public const ACTION_LINODE_MUTATE = 'linode_mutate'; |
94
|
|
|
public const ACTION_LINODE_MUTATE_CREATE = 'linode_mutate_create'; |
95
|
|
|
public const ACTION_LINODE_REBOOT = 'linode_reboot'; |
96
|
|
|
public const ACTION_LINODE_REBUILD = 'linode_rebuild'; |
97
|
|
|
public const ACTION_LINODE_RESIZE = 'linode_resize'; |
98
|
|
|
public const ACTION_LINODE_RESIZE_CREATE = 'linode_resize_create'; |
99
|
|
|
public const ACTION_LINODE_SHUTDOWN = 'linode_shutdown'; |
100
|
|
|
public const ACTION_LINODE_SNAPSHOT = 'linode_snapshot'; |
101
|
|
|
public const ACTION_LINODE_CONFIG_CREATE = 'linode_config_create'; |
102
|
|
|
public const ACTION_LINODE_CONFIG_DELETE = 'linode_config_delete'; |
103
|
|
|
public const ACTION_LINODE_CONFIG_UPDATE = 'linode_config_update'; |
104
|
|
|
public const ACTION_LONGVIEWCLIENT_CREATE = 'longviewclient_create'; |
105
|
|
|
public const ACTION_LONGVIEWCLIENT_DELETE = 'longviewclient_delete'; |
106
|
|
|
public const ACTION_LONGVIEWCLIENT_UPDATE = 'longviewclient_update'; |
107
|
|
|
public const ACTION_MANAGED_DISABLED = 'managed_disabled'; |
108
|
|
|
public const ACTION_MANAGED_ENABLED = 'managed_enabled'; |
109
|
|
|
public const ACTION_MANAGED_SERVICE_CREATE = 'managed_service_create'; |
110
|
|
|
public const ACTION_MANAGED_SERVICE_DELETE = 'managed_service_delete'; |
111
|
|
|
public const ACTION_NODEBALANCER_CREATE = 'nodebalancer_create'; |
112
|
|
|
public const ACTION_NODEBALANCER_DELETE = 'nodebalancer_delete'; |
113
|
|
|
public const ACTION_NODEBALANCER_UPDATE = 'nodebalancer_update'; |
114
|
|
|
public const ACTION_NODEBALANCER_CONFIG_CREATE = 'nodebalancer_config_create'; |
115
|
|
|
public const ACTION_NODEBALANCER_CONFIG_DELETE = 'nodebalancer_config_delete'; |
116
|
|
|
public const ACTION_NODEBALANCER_CONFIG_UPDATE = 'nodebalancer_config_update'; |
117
|
|
|
public const ACTION_NODEBALANCER_NODE_CREATE = 'nodebalancer_node_create'; |
118
|
|
|
public const ACTION_NODEBALANCER_NODE_DELETE = 'nodebalancer_node_delete'; |
119
|
|
|
public const ACTION_NODEBALANCER_NODE_UPDATE = 'nodebalancer_node_update'; |
120
|
|
|
public const ACTION_OAUTH_CLIENT_CREATE = 'oauth_client_create'; |
121
|
|
|
public const ACTION_OAUTH_CLIENT_DELETE = 'oauth_client_delete'; |
122
|
|
|
public const ACTION_OAUTH_CLIENT_SECRET_RESET = 'oauth_client_secret_reset'; |
123
|
|
|
public const ACTION_OAUTH_CLIENT_UPDATE = 'oauth_client_update'; |
124
|
|
|
public const ACTION_PASSWORD_RESET = 'password_reset'; |
125
|
|
|
public const ACTION_PAYMENT_SUBMITTED = 'payment_submitted'; |
126
|
|
|
public const ACTION_PROFILE_UPDATE = 'profile_update'; |
127
|
|
|
public const ACTION_STACKSCRIPT_CREATE = 'stackscript_create'; |
128
|
|
|
public const ACTION_STACKSCRIPT_DELETE = 'stackscript_delete'; |
129
|
|
|
public const ACTION_STACKSCRIPT_UPDATE = 'stackscript_update'; |
130
|
|
|
public const ACTION_STACKSCRIPT_PUBLICIZE = 'stackscript_publicize'; |
131
|
|
|
public const ACTION_STACKSCRIPT_REVISE = 'stackscript_revise'; |
132
|
|
|
public const ACTION_TAG_CREATE = 'tag_create'; |
133
|
|
|
public const ACTION_TAG_DELETE = 'tag_delete'; |
134
|
|
|
public const ACTION_TFA_DISABLED = 'tfa_disabled'; |
135
|
|
|
public const ACTION_TFA_ENABLED = 'tfa_enabled'; |
136
|
|
|
public const ACTION_TICKET_ATTACHMENT_UPLOAD = 'ticket_attachment_upload'; |
137
|
|
|
public const ACTION_TICKET_CREATE = 'ticket_create'; |
138
|
|
|
public const ACTION_TICKET_UPDATE = 'ticket_update'; |
139
|
|
|
public const ACTION_TOKEN_CREATE = 'token_create'; |
140
|
|
|
public const ACTION_TOKEN_DELETE = 'token_delete'; |
141
|
|
|
public const ACTION_TOKEN_UPDATE = 'token_update'; |
142
|
|
|
public const ACTION_USER_CREATE = 'user_create'; |
143
|
|
|
public const ACTION_USER_UPDATE = 'user_update'; |
144
|
|
|
public const ACTION_USER_DELETE = 'user_delete'; |
145
|
|
|
public const ACTION_USER_SSH_KEY_ADD = 'user_ssh_key_add'; |
146
|
|
|
public const ACTION_USER_SSH_KEY_DELETE = 'user_ssh_key_delete'; |
147
|
|
|
public const ACTION_USER_SSH_KEY_UPDATE = 'user_ssh_key_update'; |
148
|
|
|
public const ACTION_VLAN_ATTACH = 'vlan_attach'; |
149
|
|
|
public const ACTION_VLAN_DETACH = 'vlan_detach'; |
150
|
|
|
public const ACTION_VOLUME_ATTACH = 'volume_attach'; |
151
|
|
|
public const ACTION_VOLUME_CLONE = 'volume_clone'; |
152
|
|
|
public const ACTION_VOLUME_CREATE = 'volume_create'; |
153
|
|
|
public const ACTION_VOLUME_DELETE = 'volume_delete'; |
154
|
|
|
public const ACTION_VOLUME_UPDATE = 'volume_update'; |
155
|
|
|
public const ACTION_VOLUME_DETACH = 'volume_detach'; |
156
|
|
|
public const ACTION_VOLUME_RESIZE = 'volume_resize'; |
157
|
|
|
|
158
|
|
|
// `FIELD_STATUS` values. |
159
|
|
|
public const STATUS_FAILED = 'failed'; |
160
|
|
|
public const STATUS_FINISHED = 'finished'; |
161
|
|
|
public const STATUS_NOTIFICATION = 'notification'; |
162
|
|
|
public const STATUS_SCHEDULED = 'scheduled'; |
163
|
|
|
public const STATUS_STARTED = 'started'; |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* @codeCoverageIgnore This method was autogenerated. |
167
|
|
|
*/ |
168
|
|
|
public function __get(string $name): mixed |
169
|
|
|
{ |
170
|
|
|
return match ($name) { |
171
|
|
|
self::FIELD_ENTITY => new LinodeEntity($this->client, $this->data[$name]), |
172
|
|
|
default => parent::__get($name), |
173
|
|
|
}; |
174
|
|
|
} |
175
|
|
|
} |
176
|
|
|
|