Skip to content

Commit 9be3148

Browse files
Update SecretKey.php
Make IP address optional. If not provided don't add the ip_address child to the request. This will make Plesk take the IP of the sender. ("If this node is not specified, the IP address of the request sender will be used.")
1 parent 40990d5 commit 9be3148

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Api/Operator/SecretKey.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ class SecretKey extends \PleskX\Api\Operator
1111

1212
/**
1313
* @param string $ipAddress
14+
* @param string $keyDescription
1415
*
1516
* @return string
1617
*/
17-
public function create($ipAddress)
18+
public function create($ipAddress = '', $keyDescription = '')
1819
{
1920
$packet = $this->_client->getPacket();
20-
$packet->addChild($this->_wrapperTag)->addChild('create')->addChild('ip_address', $ipAddress);
21+
$creator = $packet->addChild($this->_wrapperTag)->addChild('create');
22+
23+
if ($ipAddress != '') {
24+
$creator->addChild('ip_address', $ipAddress);
25+
}
26+
$creator->addChild('description', $keyDescription);
27+
2128
$response = $this->_client->request($packet);
2229

2330
return (string) $response->key;

0 commit comments

Comments
 (0)