Event   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 155
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 143
c 0
b 0
f 0
dl 0
loc 155
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __get() 0 6 1
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 null|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 LinodeEntity $secondary_entity Detailed information about the Event's secondary entity, which provides additional
28
 *                                          information
29
 *                                          for events such as, but not limited to, `linode_boot`, `linode_reboot`,
30
 *                                          `linode_create`, and `linode_clone` Event actions.
31
 * @property string       $created          When this Event was created.
32
 * @property float        $duration         The total duration in seconds that it takes for the Event to complete.
33
 * @property string       $status           The current status of this Event.
34
 * @property bool         $seen             If this Event has been seen.
35
 * @property bool         $read             If this Event has been read.
36
 * @property string       $rate             The rate of completion of the Event. Only some Events will return rate; for
37
 *                                          example, migration and resize Events.
38
 * @property int          $percent_complete A percentage estimating the amount of time remaining for an Event.
39
 *                                          Returns `null` for notification events.
40
 * @property null|string  $time_remaining   The estimated time remaining until the completion of this Event. This value is
41
 *                                          only returned for some in-progress migration events. For all other in-progress
42
 *                                          events, the `percent_complete` attribute will indicate about how much more work is
43
 *                                          to be done.
44
 * @property null|string  $message          Provides additional information about the event. Additional information may
45
 *                                          include, but is not limited to, a more detailed representation of events which can
46
 *                                          help diagnose non-obvious failures.
47
 */
48
class Event extends Entity
49
{
50
    // Available fields.
51
    public const FIELD_ID               = 'id';
52
    public const FIELD_USERNAME         = 'username';
53
    public const FIELD_ACTION           = 'action';
54
    public const FIELD_ENTITY           = 'entity';
55
    public const FIELD_SECONDARY_ENTITY = 'secondary_entity';
56
    public const FIELD_CREATED          = 'created';
57
    public const FIELD_DURATION         = 'duration';
58
    public const FIELD_STATUS           = 'status';
59
    public const FIELD_SEEN             = 'seen';
60
    public const FIELD_READ             = 'read';
61
    public const FIELD_RATE             = 'rate';
62
    public const FIELD_PERCENT_COMPLETE = 'percent_complete';
63
    public const FIELD_TIME_REMAINING   = 'time_remaining';
64
    public const FIELD_MESSAGE          = 'message';
65
66
    // `FIELD_ACTION` values.
67
    public const ACTION_ACCOUNT_UPDATE                   = 'account_update';
68
    public const ACTION_ACCOUNT_SETTINGS_UPDATE          = 'account_settings_update';
69
    public const ACTION_BACKUPS_ENABLE                   = 'backups_enable';
70
    public const ACTION_BACKUPS_CANCEL                   = 'backups_cancel';
71
    public const ACTION_BACKUPS_RESTORE                  = 'backups_restore';
72
    public const ACTION_COMMUNITY_QUESTION_REPLY         = 'community_question_reply';
73
    public const ACTION_COMMUNITY_LIKE                   = 'community_like';
74
    public const ACTION_CREDIT_CARD_UPDATED              = 'credit_card_updated';
75
    public const ACTION_DISK_CREATE                      = 'disk_create';
76
    public const ACTION_DISK_DELETE                      = 'disk_delete';
77
    public const ACTION_DISK_UPDATE                      = 'disk_update';
78
    public const ACTION_DISK_DUPLICATE                   = 'disk_duplicate';
79
    public const ACTION_DISK_IMAGIZE                     = 'disk_imagize';
80
    public const ACTION_DISK_RESIZE                      = 'disk_resize';
81
    public const ACTION_DNS_RECORD_CREATE                = 'dns_record_create';
82
    public const ACTION_DNS_RECORD_DELETE                = 'dns_record_delete';
83
    public const ACTION_DNS_RECORD_UPDATE                = 'dns_record_update';
84
    public const ACTION_DNS_ZONE_CREATE                  = 'dns_zone_create';
85
    public const ACTION_DNS_ZONE_DELETE                  = 'dns_zone_delete';
86
    public const ACTION_DNS_ZONE_IMPORT                  = 'dns_zone_import';
87
    public const ACTION_DNS_ZONE_UPDATE                  = 'dns_zone_update';
88
    public const ACTION_ENTITY_TRANSFER_ACCEPT           = 'entity_transfer_accept';
89
    public const ACTION_ENTITY_TRANSFER_CANCEL           = 'entity_transfer_cancel';
90
    public const ACTION_ENTITY_TRANSFER_CREATE           = 'entity_transfer_create';
91
    public const ACTION_ENTITY_TRANSFER_FAIL             = 'entity_transfer_fail';
92
    public const ACTION_ENTITY_TRANSFER_STALE            = 'entity_transfer_stale';
93
    public const ACTION_FIREWALL_CREATE                  = 'firewall_create';
94
    public const ACTION_FIREWALL_DELETE                  = 'firewall_delete';
95
    public const ACTION_FIREWALL_DISABLE                 = 'firewall_disable';
96
    public const ACTION_FIREWALL_ENABLE                  = 'firewall_enable';
97
    public const ACTION_FIREWALL_UPDATE                  = 'firewall_update';
98
    public const ACTION_FIREWALL_DEVICE_ADD              = 'firewall_device_add';
99
    public const ACTION_FIREWALL_DEVICE_REMOVE           = 'firewall_device_remove';
100
    public const ACTION_HOST_REBOOT                      = 'host_reboot';
101
    public const ACTION_IMAGE_DELETE                     = 'image_delete';
102
    public const ACTION_IMAGE_UPDATE                     = 'image_update';
103
    public const ACTION_IMAGE_UPLOAD                     = 'image_upload';
104
    public const ACTION_IPADDRESS_UPDATE                 = 'ipaddress_update';
105
    public const ACTION_LASSIE_REBOOT                    = 'lassie_reboot';
106
    public const ACTION_LISH_BOOT                        = 'lish_boot';
107
    public const ACTION_LINODE_ADDIP                     = 'linode_addip';
108
    public const ACTION_LINODE_BOOT                      = 'linode_boot';
109
    public const ACTION_LINODE_CLONE                     = 'linode_clone';
110
    public const ACTION_LINODE_CREATE                    = 'linode_create';
111
    public const ACTION_LINODE_DELETE                    = 'linode_delete';
112
    public const ACTION_LINODE_UPDATE                    = 'linode_update';
113
    public const ACTION_LINODE_DELETEIP                  = 'linode_deleteip';
114
    public const ACTION_LINODE_MIGRATE                   = 'linode_migrate';
115
    public const ACTION_LINODE_MIGRATE_DATACENTER        = 'linode_migrate_datacenter';
116
    public const ACTION_LINODE_MIGRATE_DATACENTER_CREATE = 'linode_migrate_datacenter_create';
117
    public const ACTION_LINODE_MUTATE                    = 'linode_mutate';
118
    public const ACTION_LINODE_MUTATE_CREATE             = 'linode_mutate_create';
119
    public const ACTION_LINODE_REBOOT                    = 'linode_reboot';
120
    public const ACTION_LINODE_REBUILD                   = 'linode_rebuild';
121
    public const ACTION_LINODE_RESIZE                    = 'linode_resize';
122
    public const ACTION_LINODE_RESIZE_CREATE             = 'linode_resize_create';
123
    public const ACTION_LINODE_SHUTDOWN                  = 'linode_shutdown';
124
    public const ACTION_LINODE_SNAPSHOT                  = 'linode_snapshot';
125
    public const ACTION_LINODE_CONFIG_CREATE             = 'linode_config_create';
126
    public const ACTION_LINODE_CONFIG_DELETE             = 'linode_config_delete';
127
    public const ACTION_LINODE_CONFIG_UPDATE             = 'linode_config_update';
128
    public const ACTION_LKE_NODE_CREATE                  = 'lke_node_create';
129
    public const ACTION_LONGVIEWCLIENT_CREATE            = 'longviewclient_create';
130
    public const ACTION_LONGVIEWCLIENT_DELETE            = 'longviewclient_delete';
131
    public const ACTION_LONGVIEWCLIENT_UPDATE            = 'longviewclient_update';
132
    public const ACTION_MANAGED_DISABLED                 = 'managed_disabled';
133
    public const ACTION_MANAGED_ENABLED                  = 'managed_enabled';
134
    public const ACTION_MANAGED_SERVICE_CREATE           = 'managed_service_create';
135
    public const ACTION_MANAGED_SERVICE_DELETE           = 'managed_service_delete';
136
    public const ACTION_NODEBALANCER_CREATE              = 'nodebalancer_create';
137
    public const ACTION_NODEBALANCER_DELETE              = 'nodebalancer_delete';
138
    public const ACTION_NODEBALANCER_UPDATE              = 'nodebalancer_update';
139
    public const ACTION_NODEBALANCER_CONFIG_CREATE       = 'nodebalancer_config_create';
140
    public const ACTION_NODEBALANCER_CONFIG_DELETE       = 'nodebalancer_config_delete';
141
    public const ACTION_NODEBALANCER_CONFIG_UPDATE       = 'nodebalancer_config_update';
142
    public const ACTION_NODEBALANCER_NODE_CREATE         = 'nodebalancer_node_create';
143
    public const ACTION_NODEBALANCER_NODE_DELETE         = 'nodebalancer_node_delete';
144
    public const ACTION_NODEBALANCER_NODE_UPDATE         = 'nodebalancer_node_update';
145
    public const ACTION_OAUTH_CLIENT_CREATE              = 'oauth_client_create';
146
    public const ACTION_OAUTH_CLIENT_DELETE              = 'oauth_client_delete';
147
    public const ACTION_OAUTH_CLIENT_SECRET_RESET        = 'oauth_client_secret_reset';
148
    public const ACTION_OAUTH_CLIENT_UPDATE              = 'oauth_client_update';
149
    public const ACTION_OBJ_ACCESS_KEY_CREATE            = 'obj_access_key_create';
150
    public const ACTION_OBJ_ACCESS_KEY_DELETE            = 'obj_access_key_delete';
151
    public const ACTION_OBJ_ACCESS_KEY_UPDATE            = 'obj_access_key_update';
152
    public const ACTION_PASSWORD_RESET                   = 'password_reset';
153
    public const ACTION_PAYMENT_METHOD_ADD               = 'payment_method_add';
154
    public const ACTION_PAYMENT_SUBMITTED                = 'payment_submitted';
155
    public const ACTION_PROFILE_UPDATE                   = 'profile_update';
156
    public const ACTION_STACKSCRIPT_CREATE               = 'stackscript_create';
157
    public const ACTION_STACKSCRIPT_DELETE               = 'stackscript_delete';
158
    public const ACTION_STACKSCRIPT_UPDATE               = 'stackscript_update';
159
    public const ACTION_STACKSCRIPT_PUBLICIZE            = 'stackscript_publicize';
160
    public const ACTION_STACKSCRIPT_REVISE               = 'stackscript_revise';
161
    public const ACTION_TAG_CREATE                       = 'tag_create';
162
    public const ACTION_TAG_DELETE                       = 'tag_delete';
163
    public const ACTION_TFA_DISABLED                     = 'tfa_disabled';
164
    public const ACTION_TFA_ENABLED                      = 'tfa_enabled';
165
    public const ACTION_TICKET_ATTACHMENT_UPLOAD         = 'ticket_attachment_upload';
166
    public const ACTION_TICKET_CREATE                    = 'ticket_create';
167
    public const ACTION_TICKET_UPDATE                    = 'ticket_update';
168
    public const ACTION_TOKEN_CREATE                     = 'token_create';
169
    public const ACTION_TOKEN_DELETE                     = 'token_delete';
170
    public const ACTION_TOKEN_UPDATE                     = 'token_update';
171
    public const ACTION_USER_CREATE                      = 'user_create';
172
    public const ACTION_USER_UPDATE                      = 'user_update';
173
    public const ACTION_USER_DELETE                      = 'user_delete';
174
    public const ACTION_USER_SSH_KEY_ADD                 = 'user_ssh_key_add';
175
    public const ACTION_USER_SSH_KEY_DELETE              = 'user_ssh_key_delete';
176
    public const ACTION_USER_SSH_KEY_UPDATE              = 'user_ssh_key_update';
177
    public const ACTION_VLAN_ATTACH                      = 'vlan_attach';
178
    public const ACTION_VLAN_DETACH                      = 'vlan_detach';
179
    public const ACTION_VOLUME_ATTACH                    = 'volume_attach';
180
    public const ACTION_VOLUME_CLONE                     = 'volume_clone';
181
    public const ACTION_VOLUME_CREATE                    = 'volume_create';
182
    public const ACTION_VOLUME_DELETE                    = 'volume_delete';
183
    public const ACTION_VOLUME_UPDATE                    = 'volume_update';
184
    public const ACTION_VOLUME_DETACH                    = 'volume_detach';
185
    public const ACTION_VOLUME_RESIZE                    = 'volume_resize';
186
187
    // `FIELD_STATUS` values.
188
    public const STATUS_FAILED       = 'failed';
189
    public const STATUS_FINISHED     = 'finished';
190
    public const STATUS_NOTIFICATION = 'notification';
191
    public const STATUS_SCHEDULED    = 'scheduled';
192
    public const STATUS_STARTED      = 'started';
193
194
    /**
195
     * @codeCoverageIgnore This method was autogenerated.
196
     */
197
    public function __get(string $name): mixed
198
    {
199
        return match ($name) {
200
            self::FIELD_ENTITY,
201
            self::FIELD_SECONDARY_ENTITY => new LinodeEntity($this->client, $this->data[$name]),
202
            default                      => parent::__get($name),
203
        };
204
    }
205
}
206