StorageDisk Models & Symbols

This commit is contained in:
alphayax 2016-06-09 12:47:13 +02:00
parent 705099d77a
commit 5fb446ca06
10 changed files with 556 additions and 1 deletions

View File

@ -18,7 +18,7 @@ class FreeplugNetwork extends Model {
* FreeplugNetwork constructor.
* @param array $properties_x
*/
public function __construct(array $properties_x){
public function __construct( array $properties_x){
parent::__construct( $properties_x);
$this->initPropertyArray( 'members', Freeplug::class);
}

View File

@ -0,0 +1,159 @@
<?php
namespace alphayax\freebox\api\v3\models\Storage;
use alphayax\freebox\api\v3\Model;
use alphayax\freebox\api\v3\models;
use alphayax\freebox\api\v3\symbols;
/**
* Class DiskPartition
* @package alphayax\freebox\api\v3\models\Storage
*/
class DiskPartition extends Model {
/** @var int (Read-only) : unique partition id */
protected $id;
/** @var int (Read-only) : related disk id */
protected $disk_id;
/**
* @var string
* @see symbols\Storage\DiskPartition\State
*/
protected $state;
/**
* @var string (Read-only)
* @see symbols\Storage\DiskPartition\FsType
*/
protected $fstype;
/** @var string : partition name */
protected $label;
/** @var string (Read-only) : partition mount point (encoded in base64 as explained in fs API) */
protected $path;
/** @var int (Read-only) : partition size (in bytes) */
protected $total_bytes;
/** @var int (Read-only) : partition used space (in bytes) */
protected $used_bytes;
/** @var int (Read-only) : partition free space (in bytes) */
protected $free_bytes;
/**
* @var string (Read-only) : fsck result
* @see symbols\Storage\DiskPartition\FsckResult
*/
protected $fsck_result;
/** @var OperationProgress (Read-only) : partition operation progress */
protected $operation_pct;
/**
* DiskPartition constructor.
* @param array $properties_x
*/
public function __construct( array $properties_x){
parent::__construct( $properties_x);
$this->initProperty( 'operation_pct', OperationProgress::class);
}
/**
* @return int
*/
public function getId() {
return $this->id;
}
/**
* @return int
*/
public function getDiskId() {
return $this->disk_id;
}
/**
* @return string
* @see symbols\Storage\DiskPartition\State
*/
public function getState() {
return $this->state;
}
/**
* @param string $state
* @see symbols\Storage\DiskPartition\State
*/
public function setState( $state) {
$this->state = $state;
}
/**
* @return string
* @see symbols\Storage\DiskPartition\FsType
*/
public function getFstype() {
return $this->fstype;
}
/**
* @return string
*/
public function getLabel() {
return $this->label;
}
/**
* @param string $label
*/
public function setLabel( $label) {
$this->label = $label;
}
/**
* @return string
*/
public function getPath() {
return $this->path;
}
/**
* @return int
*/
public function getTotalBytes() {
return $this->total_bytes;
}
/**
* @return int
*/
public function getUsedBytes() {
return $this->used_bytes;
}
/**
* @return int
*/
public function getFreeBytes() {
return $this->free_bytes;
}
/**
* @return string
* @see symbols\Storage\DiskPartition\FsckResult
*/
public function getFsckResult() {
return $this->fsck_result;
}
/**
* @return \alphayax\freebox\api\v3\models\Storage\OperationProgress
*/
public function getOperationPct() {
return $this->operation_pct;
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace alphayax\freebox\api\v3\models\Storage;
use alphayax\freebox\api\v3\Model;
/**
* Class OperationProgress
* @package alphayax\freebox\api\v3\models\Storage
*/
class OperationProgress extends Model {
/** @var int (Read-only) : number of steps done */
protected $done_steps;
/** @var int (Read-only) : total number of steps */
protected $max_steps;
/** @var int (Read-only) : current step progress */
protected $percent;
/**
* @return int
*/
public function getDoneSteps() {
return $this->done_steps;
}
/**
* @return int
*/
public function getMaxSteps() {
return $this->max_steps;
}
/**
* @return int
*/
public function getPercent() {
return $this->percent;
}
}

View File

@ -0,0 +1,213 @@
<?php
namespace alphayax\freebox\api\v3\models\Storage;
use alphayax\freebox\api\v3\Model;
use alphayax\freebox\api\v3\symbols;
use alphayax\freebox\api\v3\models;
/**
* Class StorageDisk
* @package alphayax\freebox\api\v3\models\Storage
*/
class StorageDisk extends Model {
/** @var int (Read-only) : the disk id */
protected $id;
/**
* @var string (Read-only)
* @see symbols\Storage\StorageDisk\Type
*/
protected $type;
/**
* @var string
* @see symbols\Storage\StorageDisk\State
*/
protected $state;
/** @var int (Read-only) : Disk physical connector id */
protected $connector;
/** @var int (Read-only) : Disk size (in bytes) */
protected $total_bytes;
/**
* @var int (Read-only) : table_type
* @see symbols\Storage\StorageDisk\TableType
*/
protected $table_type;
/** @var string (Read-only) : Disk model */
protected $model;
/** @var string (Read-only) : Disk serial number */
protected $serial;
/** @var string (Read-only) : Disk firmware version */
protected $firmware;
/** @var int (Read-only) : Disk temperature (when supported) in °C */
protected $temp;
/** @var OperationProgress (Read-only) : partition operation progress */
protected $operation_pct;
/** @var DiskPartition[] (Read-only) : list of disk partitions */
protected $partitions;
/** @var bool (Read-only) : is disk idle (when available) */
protected $idle;
/** @var int (Read-only) : disk idle duration (in seconds) (when available) */
protected $idle_duration;
/** @var bool (Read-only) : is disk spinning (when available) */
protected $spinning;
/** @var int (Read-only) : disk activity duration (in seconds) (when available) */
protected $active_duration;
/** @var int (Read-only) : seconds left before disk spin down (in seconds) (when available) */
protected $time_before_spindown;
/**
* StorageDisk constructor.
* @param array $properties_x
*/
public function __construct( array $properties_x){
parent::__construct( $properties_x);
$this->initPropertyArray( 'partitions', DiskPartition::class);
}
/**
* @return int
*/
public function getId() {
return $this->id;
}
/**
* @return string
* @see symbols\Storage\StorageDisk\Type
*/
public function getType() {
return $this->type;
}
/**
* @return string
* @see symbols\Storage\StorageDisk\State
*/
public function getState() {
return $this->state;
}
/**
* @param string $state
* @see symbols\Storage\StorageDisk\State
*/
public function setState( $state) {
$this->state = $state;
}
/**
* @return int
*/
public function getConnector() {
return $this->connector;
}
/**
* @return int
*/
public function getTotalBytes() {
return $this->total_bytes;
}
/**
* @return int
* @see symbols\Storage\StorageDisk\TableType
*/
public function getTableType() {
return $this->table_type;
}
/**
* @return string
*/
public function getModel() {
return $this->model;
}
/**
* @return string
*/
public function getSerial() {
return $this->serial;
}
/**
* @return string
*/
public function getFirmware() {
return $this->firmware;
}
/**
* @return int
*/
public function getTemp() {
return $this->temp;
}
/**
* @return \alphayax\freebox\api\v3\models\Storage\OperationProgress
*/
public function getOperationPct() {
return $this->operation_pct;
}
/**
* @return \alphayax\freebox\api\v3\models\Storage\DiskPartition[] (Read-only)
*/
public function getPartitions() {
return $this->partitions;
}
/**
* @return boolean
*/
public function isIdle() {
return $this->idle;
}
/**
* @return int
*/
public function getIdleDuration() {
return $this->idle_duration;
}
/**
* @return boolean
*/
public function isSpinning() {
return $this->spinning;
}
/**
* @return int
*/
public function getActiveDuration() {
return $this->active_duration;
}
/**
* @return int
*/
public function getTimeBeforeSpindown() {
return $this->time_before_spindown;
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace alphayax\freebox\api\v3\symbols\Storage\DiskPartition;
/**
* Symbol FsType
* @package alphayax\freebox\api\v3\symbols\Storage\DiskPartition
* @see alphayax\freebox\api\v3\models\Storage\DiskPartition
*/
interface FsType {
const NONE = 'empty';
const UNKNOWN = 'unknown';
const XFS = 'xfs';
const EXT4 = 'ext4';
const VFAT = 'vfat';
const NTF = 'ntf';
const HF = 'hf';
const HFS_PLUS = 'hfsplus';
const SWAP = 'swap';
const EXFAT = 'exfat';
}

View File

@ -0,0 +1,28 @@
<?php
namespace alphayax\freebox\api\v3\symbols\Storage\DiskPartition;
/**
* Symbol FsckResult
* @package alphayax\freebox\api\v3\symbols\Storage\DiskPartition
* @see alphayax\freebox\api\v3\models\Storage\DiskPartition
*/
interface FsckResult {
/** Partition has not been checked yet */
const NO_RUN_YET = 'no_run_yet';
/** Check is in progress */
const RUNNING = 'running';
/** File system is ok */
const FS_CLEAN = 'fs_clean';
/** File system was corrected */
const FS_CORRECTED = 'fs_corrected';
/** File system need correction */
const FS_NEED_CORRECTION = 'fs_needs_correction';
/** File system has unrecoverable error */
const FAILED = 'failed';
}

View File

@ -0,0 +1,37 @@
<?php
namespace alphayax\freebox\api\v3\symbols\Storage\DiskPartition;
/**
* Symbol State
* @package alphayax\freebox\api\v3\symbols\Storage\DiskPartition
* @see alphayax\freebox\api\v3\models\Storage\DiskPartition
*/
interface State {
/** Partition has error */
const ERROR = 'error';
/** Partition check in progress */
const CHECKING = 'checking';
/** Partition format in progress */
const FORMATTING = 'formatting';
/** Partition mount in progress */
const MOUNTING = 'mounting';
/** Partition is in maintenance mode */
const MAINTENANCE = 'maintenance';
/** Partition is ready */
const MOUNTED = 'mounted';
/** Partition umount in progress */
const UNMOUNTING = 'umounting';
/** Partition is umounted */
const UNMOUNTED = 'umounted';
/** Partition ejection in progress */
const EJECTING = 'ejecting';
}

View File

@ -0,0 +1,22 @@
<?php
namespace alphayax\freebox\api\v3\symbols\Storage\StorageDisk;
/**
* Symbol State
* @package alphayax\freebox\api\v3\symbols\Storage\StorageDisk
* @see alphayax\freebox\api\v3\models\Storage\StorageDisk
*/
interface State {
/** Disk has error */
const ERROR = 'error';
/** Disk is disabled */
const DISABLED = 'disabled';
/** Disk is enabled */
const ENABLED = 'enabled';
/** Disk is formatting */
const FORMATTING = 'formatting';
}

View File

@ -0,0 +1,15 @@
<?php
namespace alphayax\freebox\api\v3\symbols\Storage\StorageDisk;
/**
* Symbol TableType
* @package alphayax\freebox\api\v3\symbols\Storage\StorageDisk
* @see alphayax\freebox\api\v3\models\Storage\StorageDisk
*/
interface TableType {
const MSDOS = 'msdos';
const GPT = 'gpt';
const SUPERFLOPPY = 'superfloppy';
const NONE = 'empty';
}

View File

@ -0,0 +1,19 @@
<?php
namespace alphayax\freebox\api\v3\symbols\Storage\StorageDisk;
/**
* Symbol Type
* @package alphayax\freebox\api\v3\symbols\Storage\StorageDisk
* @see alphayax\freebox\api\v3\models\Storage\StorageDisk
*/
interface Type {
/** Freebox internal disk */
const INTERNAL = 'internal';
/** usb disk */
const USB = 'usb';
/** sata disk */
const SATA = 'sata';
}