Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting disk usage details #54

Merged
merged 4 commits into from
Mar 4, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Api/Operator/Webspace.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,15 @@ public function getAll()
return $this->_getItems(Struct\GeneralInfo::class, 'gen_info');
}

/**
* @param string $field
* @param integer|string $value
* @return Struct\DiskUsage
*/
public function getDiskUsage($field, $value)
{
$items = $this->_getItems(Struct\DiskUsage::class, 'disk_usage', $field, $value);
return reset($items);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove white-space change

}
4 changes: 4 additions & 0 deletions src/Api/Struct/Site/GeneralInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ class GeneralInfo extends \PleskX\Api\Struct
/** @var string */
public $guid;

/** @var string */
public $status;

/** @var string */
public $description;

Expand All @@ -22,6 +25,7 @@ public function __construct($apiResponse)
$this->_initScalarProperties($apiResponse, [
'name',
'ascii-name',
'status',
'guid',
'description',
]);
Expand Down
66 changes: 66 additions & 0 deletions src/Api/Struct/Webspace/DiskUsage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
// Copyright 1999-2019. Plesk International GmbH.
// Author: Frederic Leclercq

namespace PleskX\Api\Struct\Webspace;

class DiskUsage extends \PleskX\Api\Struct
{
/** @var string */
public $name;

baldhead marked this conversation as resolved.
Show resolved Hide resolved
/** @var string */
public $guid;

/** @var integer */
public $httpdocs;

/** @var integer */
public $httpsdocs;

/** @var integer */
public $subdomains;

/** @var integer */
public $anonftp;

/** @var integer */
public $logs;

/** @var integer */
public $dbases;

/** @var integer */
public $mailboxes;

/** @var integer */
public $maillists;

/** @var integer */
public $domaindumps;

/** @var integer */
public $configs;

/** @var integer */
public $chroot;

public function __construct($apiResponse)
{
$this->_initScalarProperties($apiResponse, [
'name',
'guid',
'httpdocs',
'httpsdocs',
'subdomains',
'anonftp',
'logs',
'dbases',
'mailboxes',
'maillists',
'domaindumps',
'configs',
'chroot',
]);
}
}
7 changes: 7 additions & 0 deletions tests/WebspaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ public function testGetLimitDescriptor()
$this->assertNotEmpty($descriptor->limits);
}

public function testGetDiskUsage()
mrsombre marked this conversation as resolved.
Show resolved Hide resolved
{
$diskusage = static::$_client->webspace()->getDiskUsage();
baldhead marked this conversation as resolved.
Show resolved Hide resolved
$this->assertNotEmpty($diskusage->name);
$this->assertNotEmpty($diskusage->guid);
}

public function testGetPhysicalHostingDescriptor()
{
$descriptor = static::$_client->webspace()->getPhysicalHostingDescriptor();
Expand Down