feat: add unfreeze_on_demand to remaining 35 SDKs
Updated awk, bash, clojure, cobol, cpp, crystal, csharp, dart, dotnet, d, elixir, erlang, fortran, fsharp, groovy, haskell, julia, kotlin, lisp, lua, nim, objective-c, ocaml, perl, php (sync+async), powershell, prolog, raku, r, scheme, swift, tcl, v, and zig SDKs: - Add set_unfreeze_on_demand function (PATCH /services/:id) - Add --unfreeze-on-demand flag for service creation - Add --set-unfreeze-on-demand command for existing services
This commit is contained in:
parent
e58adcd5fe
commit
7e56327056
35 changed files with 1047 additions and 104 deletions
|
|
@ -1065,6 +1065,9 @@ class Unsandbox {
|
|||
if (isset($opts['input_files'])) {
|
||||
$data['input_files'] = $opts['input_files'];
|
||||
}
|
||||
if (isset($opts['unfreeze_on_demand']) && $opts['unfreeze_on_demand']) {
|
||||
$data['unfreeze_on_demand'] = true;
|
||||
}
|
||||
|
||||
return $this->makeRequest('POST', '/services', $publicKey, $secretKey, $data);
|
||||
}
|
||||
|
|
@ -1180,6 +1183,22 @@ class Unsandbox {
|
|||
return $this->makeRequest('POST', "/services/{$serviceId}/unlock", $publicKey, $secretKey, []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set unfreeze_on_demand flag for a service.
|
||||
*
|
||||
* @param string $serviceId Service ID
|
||||
* @param bool $enabled Whether to enable unfreeze on demand
|
||||
* @param string|null $publicKey Optional API key
|
||||
* @param string|null $secretKey Optional API secret
|
||||
* @return array Response array with update confirmation
|
||||
* @throws CredentialsException Missing credentials
|
||||
* @throws ApiException API request failed
|
||||
*/
|
||||
public function setUnfreezeOnDemand(string $serviceId, bool $enabled, ?string $publicKey = null, ?string $secretKey = null): array {
|
||||
[$publicKey, $secretKey] = $this->resolveCredentials($publicKey, $secretKey);
|
||||
return $this->makeRequest('PATCH', "/services/{$serviceId}", $publicKey, $secretKey, ['unfreeze_on_demand' => $enabled]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bootstrap logs for a service.
|
||||
*
|
||||
|
|
@ -2227,6 +2246,14 @@ class Unsandbox {
|
|||
return;
|
||||
}
|
||||
|
||||
if ($serviceOpts['set_unfreeze_on_demand']) {
|
||||
$enabled = in_array($serviceOpts['set_unfreeze_on_demand_enabled'], ['true', '1'], true);
|
||||
$result = $this->setUnfreezeOnDemand($serviceOpts['set_unfreeze_on_demand'], $enabled);
|
||||
$status = $enabled ? 'enabled' : 'disabled';
|
||||
echo "Unfreeze-on-demand {$status} for service: " . $serviceOpts['set_unfreeze_on_demand'] . "\n";
|
||||
return;
|
||||
}
|
||||
|
||||
// Create new service
|
||||
if (!empty($serviceOpts['name'])) {
|
||||
$createOpts = [];
|
||||
|
|
@ -2242,6 +2269,9 @@ class Unsandbox {
|
|||
if (!empty($serviceOpts['domains'])) {
|
||||
$createOpts['custom_domains'] = explode(',', $serviceOpts['domains']);
|
||||
}
|
||||
if ($serviceOpts['unfreeze_on_demand']) {
|
||||
$createOpts['unfreeze_on_demand'] = true;
|
||||
}
|
||||
|
||||
// Handle bootstrap from file
|
||||
$bootstrap = $serviceOpts['bootstrap'] ?? '';
|
||||
|
|
@ -2307,6 +2337,9 @@ class Unsandbox {
|
|||
'execute_cmd' => null,
|
||||
'snapshot' => null,
|
||||
'snapshot_name' => null,
|
||||
'unfreeze_on_demand' => false,
|
||||
'set_unfreeze_on_demand' => null,
|
||||
'set_unfreeze_on_demand_enabled' => null,
|
||||
];
|
||||
|
||||
$i = 0;
|
||||
|
|
@ -2378,6 +2411,13 @@ class Unsandbox {
|
|||
} elseif ($arg === '--snapshot-name') {
|
||||
$i++;
|
||||
$opts['snapshot_name'] = $args[$i] ?? null;
|
||||
} elseif ($arg === '--unfreeze-on-demand') {
|
||||
$opts['unfreeze_on_demand'] = true;
|
||||
} elseif ($arg === '--set-unfreeze-on-demand') {
|
||||
$i++;
|
||||
$opts['set_unfreeze_on_demand'] = $args[$i] ?? null;
|
||||
$i++;
|
||||
$opts['set_unfreeze_on_demand_enabled'] = $args[$i] ?? null;
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue