Files
api/services/nginx/app/objects/edge_gateways_o.php
T

87 lines
4.4 KiB
PHP

<?php
namespace objects;
use classes\db;
use classes\edge_gateway_schema_bootstrap;
use classes\object_property;
use traits\db_object_t;
class edge_gateways_o extends db
{
use db_object_t;
public object_property $department_id;
public object_property $label;
public object_property $hostname;
public object_property $agent_token_hash;
public object_property $status;
public object_property $transport_mode;
public object_property $release_channel;
public object_property $installed_version;
public object_property $target_version;
public object_property $last_heartbeat_at;
public object_property $last_seen_ip;
public object_property $discovery_status;
public object_property $is_primary;
public object_property $metadata_json;
public object_property $created_at;
public object_property $updated_at;
public object_property $deleted_at;
public function structure(): void
{
edge_gateway_schema_bootstrap::ensureTables();
$this->setTable('edge_gateways');
}
public function getObjectProperties(): void
{
$this->department_id = new object_property($this->table, $this->id, 'department_id', 'int', false);
$this->label = new object_property($this->table, $this->id, 'label', 'string', false);
$this->hostname = new object_property($this->table, $this->id, 'hostname', 'string', false);
$this->agent_token_hash = new object_property($this->table, $this->id, 'agent_token_hash', 'string', false);
$this->status = new object_property($this->table, $this->id, 'status', 'string', false);
$this->transport_mode = new object_property($this->table, $this->id, 'transport_mode', 'string', false);
$this->release_channel = new object_property($this->table, $this->id, 'release_channel', 'string', false);
$this->installed_version = new object_property($this->table, $this->id, 'installed_version', 'string', false);
$this->target_version = new object_property($this->table, $this->id, 'target_version', 'string', false);
$this->last_heartbeat_at = new object_property($this->table, $this->id, 'last_heartbeat_at', 'string', false);
$this->last_seen_ip = new object_property($this->table, $this->id, 'last_seen_ip', 'string', false);
$this->discovery_status = new object_property($this->table, $this->id, 'discovery_status', 'string', false);
$this->is_primary = new object_property($this->table, $this->id, 'is_primary', 'bool', false);
$this->metadata_json = new object_property($this->table, $this->id, 'metadata_json', 'json', false);
$this->created_at = new object_property($this->table, $this->id, 'created_at', 'timestamp', false);
$this->updated_at = new object_property($this->table, $this->id, 'updated_at', 'timestamp', false);
$this->deleted_at = new object_property($this->table, $this->id, 'deleted_at', 'timestamp', false);
}
public function objectChanged(): void
{
}
public function asArray(): array
{
$this->requireSelected();
return [
'id' => (int)$this->id,
'department_id' => (int)$this->department_id->value(),
'label' => (string)$this->label->value(),
'hostname' => $this->hostname->value() === null ? null : (string)$this->hostname->value(),
'status' => (string)$this->status->value(),
'transport_mode' => (string)$this->transport_mode->value(),
'release_channel' => (string)$this->release_channel->value(),
'installed_version' => $this->installed_version->value() === null ? null : (string)$this->installed_version->value(),
'target_version' => $this->target_version->value() === null ? null : (string)$this->target_version->value(),
'last_heartbeat_at' => $this->last_heartbeat_at->value() === null ? null : (string)$this->last_heartbeat_at->value(),
'last_seen_ip' => $this->last_seen_ip->value() === null ? null : (string)$this->last_seen_ip->value(),
'discovery_status' => (string)$this->discovery_status->value(),
'is_primary' => (bool)$this->is_primary->value(),
'metadata' => (array)($this->metadata_json->value() ?? []),
'created_at' => (string)$this->created_at->value(),
'updated_at' => $this->updated_at->value() === null ? null : (string)$this->updated_at->value(),
];
}
}