Skip to content

Commit 08bbf3b

Browse files
dbfxGrahamCampbell
andauthored
[4.8] Add support to disable installation of DO agent (#322)
* add $disable_agent support Based on https://docs.digitalocean.com/products/droplets/how-to/manage-agent/ with_droplet_agent parameter * fix: correct api call to false bool * Update Droplet.php --------- Co-authored-by: Graham Campbell <[email protected]>
1 parent 6497159 commit 08bbf3b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Api/Droplet.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,13 @@ public function getById(int $id)
9999
* @param bool $monitoring
100100
* @param array $volumes
101101
* @param array $tags
102+
* @param bool $disableAgent
102103
*
103104
* @throws ExceptionInterface
104105
*
105106
* @return DropletEntity|DropletEntity[]|null
106107
*/
107-
public function create($names, string $region, string $size, $image, bool $backups = false, bool $ipv6 = false, $vpcUuid = false, array $sshKeys = [], string $userData = '', bool $monitoring = true, array $volumes = [], array $tags = [])
108+
public function create($names, string $region, string $size, $image, bool $backups = false, bool $ipv6 = false, $vpcUuid = false, array $sshKeys = [], string $userData = '', bool $monitoring = true, array $volumes = [], array $tags = [], bool $disableAgent = false)
108109
{
109110
$data = \is_array($names) ? ['names' => $names] : ['name' => $names];
110111

@@ -117,6 +118,10 @@ public function create($names, string $region, string $size, $image, bool $backu
117118
'monitoring' => $monitoring ? 'true' : 'false',
118119
]);
119120

121+
if ($disableAgent) {
122+
$data['with_droplet_agent'] = 'false';
123+
}
124+
120125
if (0 < \count($sshKeys)) {
121126
$data['ssh_keys'] = $sshKeys;
122127
}

0 commit comments

Comments
 (0)