Add NetworkShare Config API
This commit is contained in:
parent
9349a6b047
commit
029f6b5a43
|
@ -55,6 +55,9 @@ Jusqu'a présent, les fonctionalités suivantes ont été implémentées :
|
||||||
- Lan (Core)
|
- Lan (Core)
|
||||||
- Lan Browser
|
- Lan Browser
|
||||||
- Wake On Lan
|
- Wake On Lan
|
||||||
|
- Network Share
|
||||||
|
- Samba
|
||||||
|
- Afp
|
||||||
- System
|
- System
|
||||||
- LCD
|
- LCD
|
||||||
- NAT
|
- NAT
|
||||||
|
|
2
TODO.md
2
TODO.md
|
@ -30,7 +30,7 @@
|
||||||
- ~~Incoming port configuration~~
|
- ~~Incoming port configuration~~
|
||||||
- ~~UPnP IGD~~
|
- ~~UPnP IGD~~
|
||||||
- ~~LCD~~
|
- ~~LCD~~
|
||||||
- Network Share
|
- ~~Network Share~~
|
||||||
- ~~UPnP AV~~
|
- ~~UPnP AV~~
|
||||||
- Switch
|
- Switch
|
||||||
- Wi-Fi
|
- Wi-Fi
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
<?php
|
||||||
|
namespace alphayax\freebox\api\v3\models\NetworkShare;
|
||||||
|
use alphayax\freebox\api\v3\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class AfpConfig
|
||||||
|
* @package alphayax\freebox\api\v3\models\NetworkShare
|
||||||
|
*/
|
||||||
|
class AfpConfig extends Model {
|
||||||
|
|
||||||
|
/** @var bool : is afp service enabled */
|
||||||
|
protected $enabled;
|
||||||
|
|
||||||
|
/** @var bool : allow guest to access shared files */
|
||||||
|
protected $guest_allow;
|
||||||
|
|
||||||
|
/** @var string : Afp server type (to display proper icon) in MacOS @see ServerType */
|
||||||
|
protected $server_type;
|
||||||
|
|
||||||
|
/** @var string : Afp user name */
|
||||||
|
protected $login_name;
|
||||||
|
|
||||||
|
/** @var string (Write-only) : Afp user password */
|
||||||
|
protected $login_password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isEnabled() {
|
||||||
|
return $this->enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param boolean $enabled
|
||||||
|
*/
|
||||||
|
public function setEnabled( $enabled) {
|
||||||
|
$this->enabled = $enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isGuestAllow() {
|
||||||
|
return $this->guest_allow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param boolean $guest_allow
|
||||||
|
*/
|
||||||
|
public function setGuestAllow( $guest_allow) {
|
||||||
|
$this->guest_allow = $guest_allow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getServerType() {
|
||||||
|
return $this->server_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $server_type
|
||||||
|
*/
|
||||||
|
public function setServerType( $server_type) {
|
||||||
|
$this->server_type = $server_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLoginName() {
|
||||||
|
return $this->login_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $login_name
|
||||||
|
*/
|
||||||
|
public function setLoginName( $login_name) {
|
||||||
|
$this->login_name = $login_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $login_password
|
||||||
|
*/
|
||||||
|
public function setLoginPassword( $login_password) {
|
||||||
|
$this->login_password = $login_password;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
<?php
|
||||||
|
namespace alphayax\freebox\api\v3\models\NetworkShare;
|
||||||
|
use alphayax\freebox\api\v3\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class SambaConfig
|
||||||
|
* @package alphayax\freebox\api\v3\models\NetworkShare
|
||||||
|
*/
|
||||||
|
class SambaConfig extends Model {
|
||||||
|
|
||||||
|
/** @var bool : is file sharing enabled */
|
||||||
|
protected $file_share_enabled;
|
||||||
|
|
||||||
|
/** @var bool : is printer sharing enabled */
|
||||||
|
protected $print_share_enabled;
|
||||||
|
|
||||||
|
/** @var bool : is login/password required to access shares */
|
||||||
|
protected $logon_enabled;
|
||||||
|
|
||||||
|
/** @var string : samba user name */
|
||||||
|
protected $logon_user;
|
||||||
|
|
||||||
|
/** @var string (Write-only) : samba user password */
|
||||||
|
protected $logon_password;
|
||||||
|
|
||||||
|
/** @var string : name of the workgroup */
|
||||||
|
protected $workgroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isFileShareEnabled() {
|
||||||
|
return $this->file_share_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param boolean $file_share_enabled
|
||||||
|
*/
|
||||||
|
public function setFileShareEnabled( $file_share_enabled) {
|
||||||
|
$this->file_share_enabled = $file_share_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isPrintShareEnabled() {
|
||||||
|
return $this->print_share_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param boolean $print_share_enabled
|
||||||
|
*/
|
||||||
|
public function setPrintShareEnabled( $print_share_enabled) {
|
||||||
|
$this->print_share_enabled = $print_share_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function isLogonEnabled() {
|
||||||
|
return $this->logon_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param boolean $logon_enabled
|
||||||
|
*/
|
||||||
|
public function setLogonEnabled( $logon_enabled) {
|
||||||
|
$this->logon_enabled = $logon_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLogonUser() {
|
||||||
|
return $this->logon_user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $logon_user
|
||||||
|
*/
|
||||||
|
public function setLogonUser( $logon_user) {
|
||||||
|
$this->logon_user = $logon_user;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $logon_password
|
||||||
|
*/
|
||||||
|
public function setLogonPassword( $logon_password) {
|
||||||
|
$this->logon_password = $logon_password;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getWorkgroup() {
|
||||||
|
return $this->workgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $workgroup
|
||||||
|
*/
|
||||||
|
public function setWorkgroup( $workgroup) {
|
||||||
|
$this->workgroup = $workgroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
namespace alphayax\freebox\api\v3\services\config\NetworkShare;
|
||||||
|
use alphayax\freebox\api\v3\Service;
|
||||||
|
use alphayax\freebox\api\v3\models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Afp
|
||||||
|
* @package alphayax\freebox\api\v3\services\config\NetworkShare
|
||||||
|
*/
|
||||||
|
class Afp extends Service {
|
||||||
|
|
||||||
|
const API_NETWORK_SHARE_AFP = '/api/v3/netshare/afp/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current Afp configuration
|
||||||
|
* @return \alphayax\freebox\api\v3\models\NetworkShare\AfpConfig
|
||||||
|
*/
|
||||||
|
public function getConfiguration(){
|
||||||
|
$rest = $this->getAuthService( self::API_NETWORK_SHARE_AFP);
|
||||||
|
$rest->GET();
|
||||||
|
|
||||||
|
return new models\NetworkShare\AfpConfig( $rest->getCurlResponse()['result']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the Afp configuration
|
||||||
|
* @param \alphayax\freebox\api\v3\models\NetworkShare\AfpConfig $afpConfig
|
||||||
|
* @return \alphayax\freebox\api\v3\models\NetworkShare\AfpConfig
|
||||||
|
*/
|
||||||
|
public function setConfiguration( models\NetworkShare\AfpConfig $afpConfig){
|
||||||
|
$rest = $this->getAuthService( self::API_NETWORK_SHARE_AFP);
|
||||||
|
$rest->PUT( $afpConfig->toArray());
|
||||||
|
|
||||||
|
return new models\NetworkShare\AfpConfig( $rest->getCurlResponse()['result']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
namespace alphayax\freebox\api\v3\services\config\NetworkShare;
|
||||||
|
use alphayax\freebox\api\v3\Service;
|
||||||
|
use alphayax\freebox\api\v3\models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Samba
|
||||||
|
* @package alphayax\freebox\api\v3\services\config\NetworkShare
|
||||||
|
*/
|
||||||
|
class Samba extends Service {
|
||||||
|
|
||||||
|
const API_NETWORK_SHARE_SAMBA = '/api/v3/netshare/samba/';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current Samba configuration
|
||||||
|
* @return \alphayax\freebox\api\v3\models\NetworkShare\SambaConfig
|
||||||
|
*/
|
||||||
|
public function getConfiguration(){
|
||||||
|
$rest = $this->getAuthService( self::API_NETWORK_SHARE_SAMBA);
|
||||||
|
$rest->GET();
|
||||||
|
|
||||||
|
return new models\NetworkShare\SambaConfig( $rest->getCurlResponse()['result']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the Samba configuration
|
||||||
|
* @param \alphayax\freebox\api\v3\models\NetworkShare\SambaConfig $sambaConfig
|
||||||
|
* @return \alphayax\freebox\api\v3\models\NetworkShare\SambaConfig
|
||||||
|
*/
|
||||||
|
public function setConfiguration( models\NetworkShare\SambaConfig $sambaConfig){
|
||||||
|
$rest = $this->getAuthService( self::API_NETWORK_SHARE_SAMBA);
|
||||||
|
$rest->PUT( $sambaConfig->toArray());
|
||||||
|
|
||||||
|
return new models\NetworkShare\SambaConfig( $rest->getCurlResponse()['result']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
namespace alphayax\freebox\api\v3\symbols\NetworkShare\AfpConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Symbol ServerType
|
||||||
|
* @package alphayax\freebox\api\v3\symbols\NetworkShare\AfpConfig
|
||||||
|
* @see alphayax\freebox\api\v3\models\NetworkShare\AfpConfig
|
||||||
|
*/
|
||||||
|
interface ServerType {
|
||||||
|
|
||||||
|
const POWERBOOK = 'powerbook';
|
||||||
|
const POWERMAC = 'powermac';
|
||||||
|
const MACMINI = 'macmini';
|
||||||
|
const IMAC = 'imac';
|
||||||
|
const MACBOOK = 'macbook';
|
||||||
|
const MACBOOK_PRO = 'macbookpro';
|
||||||
|
const MACBOOK_AIR = 'macbookair';
|
||||||
|
const MAC_PRO = 'macpro';
|
||||||
|
const APPLE_TV = 'appletv';
|
||||||
|
const AIR_PORT = 'airport';
|
||||||
|
const XSERVE = 'xserve';
|
||||||
|
}
|
Loading…
Reference in New Issue