Rename sleep/wake to freeze/unfreeze across all 42 implementations
API endpoint changes:
- /services/{id}/sleep → /services/{id}/freeze
- /services/{id}/wake → /services/{id}/unfreeze
CLI flag changes:
- --sleep → --freeze
- --wake → --unfreeze
Message changes:
- 'Service sleeping' → 'Service frozen'
- 'Service waking' → 'Service unfreezing'
This commit is contained in:
parent
bcbd5fa56a
commit
dc69bf4959
41 changed files with 178 additions and 162 deletions
16
CLAUDE.md
16
CLAUDE.md
|
|
@ -1,5 +1,21 @@
|
||||||
# Claude AI Instructions for un-inception
|
# Claude AI Instructions for un-inception
|
||||||
|
|
||||||
|
## ⚠️ CRITICAL: NEVER USE RAW LXC COMMANDS
|
||||||
|
|
||||||
|
**ALWAYS use `un` CLI commands. NEVER use raw `lxc` commands on production.**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# ✅ CORRECT - use un commands
|
||||||
|
un2 service --list
|
||||||
|
un2 service --destroy <id>
|
||||||
|
un2 service --execute <id> 'command'
|
||||||
|
|
||||||
|
# ❌ FORBIDDEN - raw lxc commands bypass auth and state sync
|
||||||
|
lxc list / lxc delete / lxc stop / lxc exec
|
||||||
|
```
|
||||||
|
|
||||||
|
On 2026-01-11, raw `lxc delete` destroyed 8 production services causing complete data loss.
|
||||||
|
|
||||||
## Commit Messages
|
## Commit Messages
|
||||||
|
|
||||||
**NEVER add Claude attribution to commit messages.** No robot emoji, no "Generated with Claude Code", no "Co-Authored-By: Claude". Just write the commit message like a human wrote it.
|
**NEVER add Claude attribution to commit messages.** No robot emoji, no "Generated with Claude Code", no "Co-Authored-By: Claude". Just write the commit message like a human wrote it.
|
||||||
|
|
|
||||||
8
Un.cs
8
Un.cs
|
|
@ -395,15 +395,15 @@ class Un
|
||||||
|
|
||||||
if (args.ServiceSleep != null)
|
if (args.ServiceSleep != null)
|
||||||
{
|
{
|
||||||
ApiRequest($"/services/{args.ServiceSleep}/sleep", "POST", null, publicKey, secretKey);
|
ApiRequest($"/services/{args.ServiceSleep}/freeze", "POST", null, publicKey, secretKey);
|
||||||
Console.WriteLine($"{GREEN}Service sleeping: {args.ServiceSleep}{RESET}");
|
Console.WriteLine($"{GREEN}Service frozen: {args.ServiceSleep}{RESET}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.ServiceWake != null)
|
if (args.ServiceWake != null)
|
||||||
{
|
{
|
||||||
ApiRequest($"/services/{args.ServiceWake}/wake", "POST", null, publicKey, secretKey);
|
ApiRequest($"/services/{args.ServiceWake}/unfreeze", "POST", null, publicKey, secretKey);
|
||||||
Console.WriteLine($"{GREEN}Service waking: {args.ServiceWake}{RESET}");
|
Console.WriteLine($"{GREEN}Service unfreezing: {args.ServiceWake}{RESET}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
Un.java
8
Un.java
|
|
@ -284,14 +284,14 @@ public class Un {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.serviceSleep != null) {
|
if (args.serviceSleep != null) {
|
||||||
apiRequest("/services/" + args.serviceSleep + "/sleep", "POST", null, publicKey, secretKey);
|
apiRequest("/services/" + args.serviceSleep + "/freeze", "POST", null, publicKey, secretKey);
|
||||||
System.out.println(GREEN + "Service sleeping: " + args.serviceSleep + RESET);
|
System.out.println(GREEN + "Service frozen: " + args.serviceSleep + RESET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.serviceWake != null) {
|
if (args.serviceWake != null) {
|
||||||
apiRequest("/services/" + args.serviceWake + "/wake", "POST", null, publicKey, secretKey);
|
apiRequest("/services/" + args.serviceWake + "/unfreeze", "POST", null, publicKey, secretKey);
|
||||||
System.out.println(GREEN + "Service waking: " + args.serviceWake + RESET);
|
System.out.println(GREEN + "Service unfreezing: " + args.serviceWake + RESET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
BIN
__pycache__/un.cpython-313.pyc
Normal file
BIN
__pycache__/un.cpython-313.pyc
Normal file
Binary file not shown.
8
un.clj
8
un.clj
|
|
@ -403,11 +403,11 @@
|
||||||
:info (println (curl-get api-key (str "/services/" sid)))
|
:info (println (curl-get api-key (str "/services/" sid)))
|
||||||
:logs (println (curl-get api-key (str "/services/" sid "/logs")))
|
:logs (println (curl-get api-key (str "/services/" sid "/logs")))
|
||||||
:sleep (do
|
:sleep (do
|
||||||
(curl-post api-key (str "/services/" sid "/sleep") "{}")
|
(curl-post api-key (str "/services/" sid "/freeze") "{}")
|
||||||
(println (str green "Service sleeping: " sid reset)))
|
(println (str green "Service frozen: " sid reset)))
|
||||||
:wake (do
|
:wake (do
|
||||||
(curl-post api-key (str "/services/" sid "/wake") "{}")
|
(curl-post api-key (str "/services/" sid "/unfreeze") "{}")
|
||||||
(println (str green "Service waking: " sid reset)))
|
(println (str green "Service unfreezing: " sid reset)))
|
||||||
:destroy (do
|
:destroy (do
|
||||||
(curl-delete api-key (str "/services/" sid))
|
(curl-delete api-key (str "/services/" sid))
|
||||||
(println (str green "Service destroyed: " sid reset)))
|
(println (str green "Service destroyed: " sid reset)))
|
||||||
|
|
|
||||||
8
un.cob
8
un.cob
|
|
@ -496,10 +496,10 @@
|
||||||
SERVICE-SLEEP.
|
SERVICE-SLEEP.
|
||||||
STRING "curl -s -X POST "
|
STRING "curl -s -X POST "
|
||||||
"https://api.unsandbox.com/services/"
|
"https://api.unsandbox.com/services/"
|
||||||
FUNCTION TRIM(WS-ID) "/sleep "
|
FUNCTION TRIM(WS-ID) "/freeze "
|
||||||
"-H 'Authorization: Bearer " FUNCTION TRIM(WS-API-KEY)
|
"-H 'Authorization: Bearer " FUNCTION TRIM(WS-API-KEY)
|
||||||
"' >/dev/null && "
|
"' >/dev/null && "
|
||||||
"echo -e '\x1b[32mService sleeping: "
|
"echo -e '\x1b[32mService frozen: "
|
||||||
FUNCTION TRIM(WS-ID) "\x1b[0m'"
|
FUNCTION TRIM(WS-ID) "\x1b[0m'"
|
||||||
DELIMITED BY SIZE INTO WS-CURL-CMD
|
DELIMITED BY SIZE INTO WS-CURL-CMD
|
||||||
END-STRING.
|
END-STRING.
|
||||||
|
|
@ -509,10 +509,10 @@
|
||||||
SERVICE-WAKE.
|
SERVICE-WAKE.
|
||||||
STRING "curl -s -X POST "
|
STRING "curl -s -X POST "
|
||||||
"https://api.unsandbox.com/services/"
|
"https://api.unsandbox.com/services/"
|
||||||
FUNCTION TRIM(WS-ID) "/wake "
|
FUNCTION TRIM(WS-ID) "/unfreeze "
|
||||||
"-H 'Authorization: Bearer " FUNCTION TRIM(WS-API-KEY)
|
"-H 'Authorization: Bearer " FUNCTION TRIM(WS-API-KEY)
|
||||||
"' >/dev/null && "
|
"' >/dev/null && "
|
||||||
"echo -e '\x1b[32mService waking: "
|
"echo -e '\x1b[32mService unfreezing: "
|
||||||
FUNCTION TRIM(WS-ID) "\x1b[0m'"
|
FUNCTION TRIM(WS-ID) "\x1b[0m'"
|
||||||
DELIMITED BY SIZE INTO WS-CURL-CMD
|
DELIMITED BY SIZE INTO WS-CURL-CMD
|
||||||
END-STRING.
|
END-STRING.
|
||||||
|
|
|
||||||
12
un.cpp
12
un.cpp
|
|
@ -475,18 +475,18 @@ void cmd_service(const string& name, const string& ports, const string& type, co
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sleep.empty()) {
|
if (!sleep.empty()) {
|
||||||
string auth_headers = build_auth_headers("POST", "/services/" + sleep + "/sleep", "", public_key, secret_key);
|
string auth_headers = build_auth_headers("POST", "/services/" + sleep + "/freeze", "", public_key, secret_key);
|
||||||
string cmd = "curl -s -X POST '" + API_BASE + "/services/" + sleep + "/sleep' " + auth_headers;
|
string cmd = "curl -s -X POST '" + API_BASE + "/services/" + sleep + "/freeze' " + auth_headers;
|
||||||
exec_curl(cmd);
|
exec_curl(cmd);
|
||||||
cout << GREEN << "Service sleeping: " << sleep << RESET << endl;
|
cout << GREEN << "Service frozen: " << sleep << RESET << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wake.empty()) {
|
if (!wake.empty()) {
|
||||||
string auth_headers = build_auth_headers("POST", "/services/" + wake + "/wake", "", public_key, secret_key);
|
string auth_headers = build_auth_headers("POST", "/services/" + wake + "/unfreeze", "", public_key, secret_key);
|
||||||
string cmd = "curl -s -X POST '" + API_BASE + "/services/" + wake + "/wake' " + auth_headers;
|
string cmd = "curl -s -X POST '" + API_BASE + "/services/" + wake + "/unfreeze' " + auth_headers;
|
||||||
exec_curl(cmd);
|
exec_curl(cmd);
|
||||||
cout << GREEN << "Service waking: " << wake << RESET << endl;
|
cout << GREEN << "Service unfreezing: " << wake << RESET << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.cr
8
un.cr
|
|
@ -552,14 +552,14 @@ def cmd_service(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
if sleep_id = args[:sleep]?.as?(String)
|
if sleep_id = args[:sleep]?.as?(String)
|
||||||
api_request("/services/#{sleep_id}/sleep", public_key, secret_key, method: "POST")
|
api_request("/services/#{sleep_id}/freeze", public_key, secret_key, method: "POST")
|
||||||
puts "#{GREEN}Service sleeping: #{sleep_id}#{RESET}"
|
puts "#{GREEN}Service frozen: #{sleep_id}#{RESET}"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if wake_id = args[:wake]?.as?(String)
|
if wake_id = args[:wake]?.as?(String)
|
||||||
api_request("/services/#{wake_id}/wake", public_key, secret_key, method: "POST")
|
api_request("/services/#{wake_id}/unfreeze", public_key, secret_key, method: "POST")
|
||||||
puts "#{GREEN}Service waking: #{wake_id}#{RESET}"
|
puts "#{GREEN}Service unfreezing: #{wake_id}#{RESET}"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
12
un.d
12
un.d
|
|
@ -414,20 +414,20 @@ void cmdService(string name, string ports, string bootstrap, string bootstrapFil
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sleep.empty) {
|
if (!sleep.empty) {
|
||||||
string path = format("/services/%s/sleep", sleep);
|
string path = format("/services/%s/freeze", sleep);
|
||||||
string authHeaders = buildAuthHeaders("POST", path, "", publicKey, secretKey);
|
string authHeaders = buildAuthHeaders("POST", path, "", publicKey, secretKey);
|
||||||
string cmd = format(`curl -s -X POST '%s/services/%s/sleep' %s`, API_BASE, sleep, authHeaders);
|
string cmd = format(`curl -s -X POST '%s/services/%s/freeze' %s`, API_BASE, sleep, authHeaders);
|
||||||
execCurl(cmd);
|
execCurl(cmd);
|
||||||
writefln("%sService sleeping: %s%s", GREEN, sleep, RESET);
|
writefln("%sService frozen: %s%s", GREEN, sleep, RESET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wake.empty) {
|
if (!wake.empty) {
|
||||||
string path = format("/services/%s/wake", wake);
|
string path = format("/services/%s/unfreeze", wake);
|
||||||
string authHeaders = buildAuthHeaders("POST", path, "", publicKey, secretKey);
|
string authHeaders = buildAuthHeaders("POST", path, "", publicKey, secretKey);
|
||||||
string cmd = format(`curl -s -X POST '%s/services/%s/wake' %s`, API_BASE, wake, authHeaders);
|
string cmd = format(`curl -s -X POST '%s/services/%s/unfreeze' %s`, API_BASE, wake, authHeaders);
|
||||||
execCurl(cmd);
|
execCurl(cmd);
|
||||||
writefln("%sService waking: %s%s", GREEN, wake, RESET);
|
writefln("%sService unfreezing: %s%s", GREEN, wake, RESET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.dart
8
un.dart
|
|
@ -556,14 +556,14 @@ Future<void> cmdService(Args args) async {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.serviceSleep != null) {
|
if (args.serviceSleep != null) {
|
||||||
await apiRequestCurl('/services/${args.serviceSleep}/sleep', 'POST', null, publicKey, secretKey);
|
await apiRequestCurl('/services/${args.serviceSleep}/freeze', 'POST', null, publicKey, secretKey);
|
||||||
print('${green}Service sleeping: ${args.serviceSleep}$reset');
|
print('${green}Service frozen: ${args.serviceSleep}$reset');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.serviceWake != null) {
|
if (args.serviceWake != null) {
|
||||||
await apiRequestCurl('/services/${args.serviceWake}/wake', 'POST', null, publicKey, secretKey);
|
await apiRequestCurl('/services/${args.serviceWake}/unfreeze', 'POST', null, publicKey, secretKey);
|
||||||
print('${green}Service waking: ${args.serviceWake}$reset');
|
print('${green}Service unfreezing: ${args.serviceWake}$reset');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.erl
8
un.erl
|
|
@ -197,16 +197,16 @@ service_command(["--logs", ServiceId | _]) ->
|
||||||
service_command(["--freeze", ServiceId | _]) ->
|
service_command(["--freeze", ServiceId | _]) ->
|
||||||
ApiKey = get_api_key(),
|
ApiKey = get_api_key(),
|
||||||
TmpFile = write_temp_file("{}"),
|
TmpFile = write_temp_file("{}"),
|
||||||
_ = curl_post(ApiKey, "/services/" ++ ServiceId ++ "/sleep", TmpFile),
|
_ = curl_post(ApiKey, "/services/" ++ ServiceId ++ "/freeze", TmpFile),
|
||||||
file:delete(TmpFile),
|
file:delete(TmpFile),
|
||||||
io:format("\033[32mService sleeping: ~s\033[0m~n", [ServiceId]);
|
io:format("\033[32mService frozen: ~s\033[0m~n", [ServiceId]);
|
||||||
|
|
||||||
service_command(["--unfreeze", ServiceId | _]) ->
|
service_command(["--unfreeze", ServiceId | _]) ->
|
||||||
ApiKey = get_api_key(),
|
ApiKey = get_api_key(),
|
||||||
TmpFile = write_temp_file("{}"),
|
TmpFile = write_temp_file("{}"),
|
||||||
_ = curl_post(ApiKey, "/services/" ++ ServiceId ++ "/wake", TmpFile),
|
_ = curl_post(ApiKey, "/services/" ++ ServiceId ++ "/unfreeze", TmpFile),
|
||||||
file:delete(TmpFile),
|
file:delete(TmpFile),
|
||||||
io:format("\033[32mService waking: ~s\033[0m~n", [ServiceId]);
|
io:format("\033[32mService unfreezing: ~s\033[0m~n", [ServiceId]);
|
||||||
|
|
||||||
service_command(["--destroy", ServiceId | _]) ->
|
service_command(["--destroy", ServiceId | _]) ->
|
||||||
ApiKey = get_api_key(),
|
ApiKey = get_api_key(),
|
||||||
|
|
|
||||||
8
un.ex
8
un.ex
|
|
@ -218,14 +218,14 @@ defmodule Un do
|
||||||
|
|
||||||
defp service_command(["--freeze", service_id | _]) do
|
defp service_command(["--freeze", service_id | _]) do
|
||||||
api_key = get_api_key()
|
api_key = get_api_key()
|
||||||
curl_post(api_key, "/services/#{service_id}/sleep", "{}")
|
curl_post(api_key, "/services/#{service_id}/freeze", "{}")
|
||||||
IO.puts("#{@green}Service sleeping: #{service_id}#{@reset}")
|
IO.puts("#{@green}Service frozen: #{service_id}#{@reset}")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp service_command(["--unfreeze", service_id | _]) do
|
defp service_command(["--unfreeze", service_id | _]) do
|
||||||
api_key = get_api_key()
|
api_key = get_api_key()
|
||||||
curl_post(api_key, "/services/#{service_id}/wake", "{}")
|
curl_post(api_key, "/services/#{service_id}/unfreeze", "{}")
|
||||||
IO.puts("#{@green}Service waking: #{service_id}#{@reset}")
|
IO.puts("#{@green}Service unfreezing: #{service_id}#{@reset}")
|
||||||
end
|
end
|
||||||
|
|
||||||
defp service_command(["--destroy", service_id | _]) do
|
defp service_command(["--destroy", service_id | _]) do
|
||||||
|
|
|
||||||
12
un.f90
12
un.f90
|
|
@ -571,24 +571,24 @@ contains
|
||||||
else if (trim(operation) == 'sleep' .and. len_trim(service_id) > 0) then
|
else if (trim(operation) == 'sleep' .and. len_trim(service_id) > 0) then
|
||||||
write(full_cmd, '(20A)') &
|
write(full_cmd, '(20A)') &
|
||||||
'TS=$(date +%s); ', &
|
'TS=$(date +%s); ', &
|
||||||
'SIG=$(echo -n "$TS:POST:/services/', trim(service_id), '/sleep:" | openssl dgst -sha256 -hmac "', trim(secret_key), '" | cut -d" " -f2); ', &
|
'SIG=$(echo -n "$TS:POST:/services/', trim(service_id), '/freeze:" | openssl dgst -sha256 -hmac "', trim(secret_key), '" | cut -d" " -f2); ', &
|
||||||
'curl -s -X POST https://api.unsandbox.com/services/', &
|
'curl -s -X POST https://api.unsandbox.com/services/', &
|
||||||
trim(service_id), '/sleep ', &
|
trim(service_id), '/freeze ', &
|
||||||
'-H "Authorization: Bearer ', trim(public_key), '" ', &
|
'-H "Authorization: Bearer ', trim(public_key), '" ', &
|
||||||
'-H "X-Timestamp: $TS" ', &
|
'-H "X-Timestamp: $TS" ', &
|
||||||
'-H "X-Signature: $SIG" >/dev/null && ', &
|
'-H "X-Signature: $SIG" >/dev/null && ', &
|
||||||
'echo -e "\x1b[32mService sleeping: ', trim(service_id), '\x1b[0m"'
|
'echo -e "\x1b[32mService frozen: ', trim(service_id), '\x1b[0m"'
|
||||||
call execute_command_line(trim(full_cmd), wait=.true.)
|
call execute_command_line(trim(full_cmd), wait=.true.)
|
||||||
else if (trim(operation) == 'wake' .and. len_trim(service_id) > 0) then
|
else if (trim(operation) == 'wake' .and. len_trim(service_id) > 0) then
|
||||||
write(full_cmd, '(20A)') &
|
write(full_cmd, '(20A)') &
|
||||||
'TS=$(date +%s); ', &
|
'TS=$(date +%s); ', &
|
||||||
'SIG=$(echo -n "$TS:POST:/services/', trim(service_id), '/wake:" | openssl dgst -sha256 -hmac "', trim(secret_key), '" | cut -d" " -f2); ', &
|
'SIG=$(echo -n "$TS:POST:/services/', trim(service_id), '/unfreeze:" | openssl dgst -sha256 -hmac "', trim(secret_key), '" | cut -d" " -f2); ', &
|
||||||
'curl -s -X POST https://api.unsandbox.com/services/', &
|
'curl -s -X POST https://api.unsandbox.com/services/', &
|
||||||
trim(service_id), '/wake ', &
|
trim(service_id), '/unfreeze ', &
|
||||||
'-H "Authorization: Bearer ', trim(public_key), '" ', &
|
'-H "Authorization: Bearer ', trim(public_key), '" ', &
|
||||||
'-H "X-Timestamp: $TS" ', &
|
'-H "X-Timestamp: $TS" ', &
|
||||||
'-H "X-Signature: $SIG" >/dev/null && ', &
|
'-H "X-Signature: $SIG" >/dev/null && ', &
|
||||||
'echo -e "\x1b[32mService waking: ', trim(service_id), '\x1b[0m"'
|
'echo -e "\x1b[32mService unfreezing: ', trim(service_id), '\x1b[0m"'
|
||||||
call execute_command_line(trim(full_cmd), wait=.true.)
|
call execute_command_line(trim(full_cmd), wait=.true.)
|
||||||
else if (trim(operation) == 'destroy' .and. len_trim(service_id) > 0) then
|
else if (trim(operation) == 'destroy' .and. len_trim(service_id) > 0) then
|
||||||
write(full_cmd, '(20A)') &
|
write(full_cmd, '(20A)') &
|
||||||
|
|
|
||||||
8
un.forth
8
un.forth
|
|
@ -299,9 +299,9 @@
|
||||||
get-secret-key r@ write-file throw
|
get-secret-key r@ write-file throw
|
||||||
s" '" r@ write-line throw
|
s" '" r@ write-line throw
|
||||||
s" TIMESTAMP=$(date +%s)" r@ write-line throw
|
s" TIMESTAMP=$(date +%s)" r@ write-line throw
|
||||||
s" MESSAGE=\"$TIMESTAMP:POST:/services/$SERVICE_ID/sleep:\"" r@ write-line throw
|
s" MESSAGE=\"$TIMESTAMP:POST:/services/$SERVICE_ID/freeze:\"" r@ write-line throw
|
||||||
s" SIGNATURE=$(echo -n \"$MESSAGE\" | openssl dgst -sha256 -hmac \"$SECRET_KEY\" -hex | sed 's/.*= //')" r@ write-line throw
|
s" SIGNATURE=$(echo -n \"$MESSAGE\" | openssl dgst -sha256 -hmac \"$SECRET_KEY\" -hex | sed 's/.*= //')" r@ write-line throw
|
||||||
s" curl -s -X POST https://api.unsandbox.com/services/$SERVICE_ID/sleep -H \"Authorization: Bearer $PUBLIC_KEY\" -H \"X-Timestamp: $TIMESTAMP\" -H \"X-Signature: $SIGNATURE\" >/dev/null && echo -e '\\x1b[32mService sleeping: " r@ write-file throw
|
s" curl -s -X POST https://api.unsandbox.com/services/$SERVICE_ID/freeze -H \"Authorization: Bearer $PUBLIC_KEY\" -H \"X-Timestamp: $TIMESTAMP\" -H \"X-Signature: $SIGNATURE\" >/dev/null && echo -e '\\x1b[32mService frozen: " r@ write-file throw
|
||||||
r@ write-file throw
|
r@ write-file throw
|
||||||
s" \\x1b[0m'" r@ write-line throw
|
s" \\x1b[0m'" r@ write-line throw
|
||||||
r> close-file throw
|
r> close-file throw
|
||||||
|
|
@ -323,9 +323,9 @@
|
||||||
get-secret-key r@ write-file throw
|
get-secret-key r@ write-file throw
|
||||||
s" '" r@ write-line throw
|
s" '" r@ write-line throw
|
||||||
s" TIMESTAMP=$(date +%s)" r@ write-line throw
|
s" TIMESTAMP=$(date +%s)" r@ write-line throw
|
||||||
s" MESSAGE=\"$TIMESTAMP:POST:/services/$SERVICE_ID/wake:\"" r@ write-line throw
|
s" MESSAGE=\"$TIMESTAMP:POST:/services/$SERVICE_ID/unfreeze:\"" r@ write-line throw
|
||||||
s" SIGNATURE=$(echo -n \"$MESSAGE\" | openssl dgst -sha256 -hmac \"$SECRET_KEY\" -hex | sed 's/.*= //')" r@ write-line throw
|
s" SIGNATURE=$(echo -n \"$MESSAGE\" | openssl dgst -sha256 -hmac \"$SECRET_KEY\" -hex | sed 's/.*= //')" r@ write-line throw
|
||||||
s" curl -s -X POST https://api.unsandbox.com/services/$SERVICE_ID/wake -H \"Authorization: Bearer $PUBLIC_KEY\" -H \"X-Timestamp: $TIMESTAMP\" -H \"X-Signature: $SIGNATURE\" >/dev/null && echo -e '\\x1b[32mService waking: " r@ write-file throw
|
s" curl -s -X POST https://api.unsandbox.com/services/$SERVICE_ID/unfreeze -H \"Authorization: Bearer $PUBLIC_KEY\" -H \"X-Timestamp: $TIMESTAMP\" -H \"X-Signature: $SIGNATURE\" >/dev/null && echo -e '\\x1b[32mService unfreezing: " r@ write-file throw
|
||||||
r@ write-file throw
|
r@ write-file throw
|
||||||
s" \\x1b[0m'" r@ write-line throw
|
s" \\x1b[0m'" r@ write-line throw
|
||||||
r> close-file throw
|
r> close-file throw
|
||||||
|
|
|
||||||
8
un.fs
8
un.fs
|
|
@ -786,11 +786,11 @@ let cmdService (args: Args) =
|
||||||
| Some logs -> printfn "%s" (logs.ToString())
|
| Some logs -> printfn "%s" (logs.ToString())
|
||||||
| None -> ()
|
| None -> ()
|
||||||
elif args.ServiceSleep.IsSome then
|
elif args.ServiceSleep.IsSome then
|
||||||
let result = apiRequest (sprintf "/services/%s/sleep" args.ServiceSleep.Value) "POST" None publicKey secretKey
|
let result = apiRequest (sprintf "/services/%s/freeze" args.ServiceSleep.Value) "POST" None publicKey secretKey
|
||||||
printfn "%sService sleeping: %s%s" green args.ServiceSleep.Value reset
|
printfn "%sService frozen: %s%s" green args.ServiceSleep.Value reset
|
||||||
elif args.ServiceWake.IsSome then
|
elif args.ServiceWake.IsSome then
|
||||||
let result = apiRequest (sprintf "/services/%s/wake" args.ServiceWake.Value) "POST" None publicKey secretKey
|
let result = apiRequest (sprintf "/services/%s/unfreeze" args.ServiceWake.Value) "POST" None publicKey secretKey
|
||||||
printfn "%sService waking: %s%s" green args.ServiceWake.Value reset
|
printfn "%sService unfreezing: %s%s" green args.ServiceWake.Value reset
|
||||||
elif args.ServiceDestroy.IsSome then
|
elif args.ServiceDestroy.IsSome then
|
||||||
let result = apiRequest (sprintf "/services/%s" args.ServiceDestroy.Value) "DELETE" None publicKey secretKey
|
let result = apiRequest (sprintf "/services/%s" args.ServiceDestroy.Value) "DELETE" None publicKey secretKey
|
||||||
printfn "%sService destroyed: %s%s" green args.ServiceDestroy.Value reset
|
printfn "%sService destroyed: %s%s" green args.ServiceDestroy.Value reset
|
||||||
|
|
|
||||||
8
un.go
8
un.go
|
|
@ -673,14 +673,14 @@ func cmdService(serviceName, servicePorts, serviceDomains, serviceType, serviceB
|
||||||
}
|
}
|
||||||
|
|
||||||
if serviceSleep != "" {
|
if serviceSleep != "" {
|
||||||
apiRequest("/services/"+serviceSleep+"/sleep", "POST", nil, publicKey, secretKey)
|
apiRequest("/services/"+serviceSleep+"/freeze", "POST", nil, publicKey, secretKey)
|
||||||
fmt.Printf("%sService sleeping: %s%s\n", Green, serviceSleep, Reset)
|
fmt.Printf("%sService frozen: %s%s\n", Green, serviceSleep, Reset)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if serviceWake != "" {
|
if serviceWake != "" {
|
||||||
apiRequest("/services/"+serviceWake+"/wake", "POST", nil, publicKey, secretKey)
|
apiRequest("/services/"+serviceWake+"/unfreeze", "POST", nil, publicKey, secretKey)
|
||||||
fmt.Printf("%sService waking: %s%s\n", Green, serviceWake, Reset)
|
fmt.Printf("%sService unfreezing: %s%s\n", Green, serviceWake, Reset)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -756,14 +756,14 @@ def cmdService(args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.serviceSleep) {
|
if (args.serviceSleep) {
|
||||||
apiRequest("/services/${args.serviceSleep}/sleep", 'POST', null, publicKey, secretKey)
|
apiRequest("/services/${args.serviceSleep}/freeze", 'POST', null, publicKey, secretKey)
|
||||||
println("${GREEN}Service sleeping: ${args.serviceSleep}${RESET}")
|
println("${GREEN}Service frozen: ${args.serviceSleep}${RESET}")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.serviceWake) {
|
if (args.serviceWake) {
|
||||||
apiRequest("/services/${args.serviceWake}/wake", 'POST', null, publicKey, secretKey)
|
apiRequest("/services/${args.serviceWake}/unfreeze", 'POST', null, publicKey, secretKey)
|
||||||
println("${GREEN}Service waking: ${args.serviceWake}${RESET}")
|
println("${GREEN}Service unfreezing: ${args.serviceWake}${RESET}")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.hs
8
un.hs
|
|
@ -464,11 +464,11 @@ serviceCommand opts = do
|
||||||
(_, stdout, _) <- curlGet apiKey ("https://api.unsandbox.com/services/" ++ sid ++ "/logs")
|
(_, stdout, _) <- curlGet apiKey ("https://api.unsandbox.com/services/" ++ sid ++ "/logs")
|
||||||
putStrLn stdout
|
putStrLn stdout
|
||||||
ServiceSleep sid -> do
|
ServiceSleep sid -> do
|
||||||
(_, stdout, _) <- curlPost apiKey ("https://api.unsandbox.com/services/" ++ sid ++ "/sleep") "{}"
|
(_, stdout, _) <- curlPost apiKey ("https://api.unsandbox.com/services/" ++ sid ++ "/freeze") "{}"
|
||||||
putStrLn $ green ++ "Service sleeping: " ++ sid ++ reset
|
putStrLn $ green ++ "Service frozen: " ++ sid ++ reset
|
||||||
ServiceWake sid -> do
|
ServiceWake sid -> do
|
||||||
(_, stdout, _) <- curlPost apiKey ("https://api.unsandbox.com/services/" ++ sid ++ "/wake") "{}"
|
(_, stdout, _) <- curlPost apiKey ("https://api.unsandbox.com/services/" ++ sid ++ "/unfreeze") "{}"
|
||||||
putStrLn $ green ++ "Service waking: " ++ sid ++ reset
|
putStrLn $ green ++ "Service unfreezing: " ++ sid ++ reset
|
||||||
ServiceDestroy sid -> do
|
ServiceDestroy sid -> do
|
||||||
(_, stdout, _) <- curlDelete apiKey ("https://api.unsandbox.com/services/" ++ sid)
|
(_, stdout, _) <- curlDelete apiKey ("https://api.unsandbox.com/services/" ++ sid)
|
||||||
putStrLn $ green ++ "Service destroyed: " ++ sid ++ reset
|
putStrLn $ green ++ "Service destroyed: " ++ sid ++ reset
|
||||||
|
|
|
||||||
8
un.jl
8
un.jl
|
|
@ -531,14 +531,14 @@ function cmd_service(args)
|
||||||
end
|
end
|
||||||
|
|
||||||
if args["sleep"] !== nothing
|
if args["sleep"] !== nothing
|
||||||
api_request("/services/$(args["sleep"])/sleep", public_key, secret_key, method="POST")
|
api_request("/services/$(args["sleep"])/freeze", public_key, secret_key, method="POST")
|
||||||
println("$(GREEN)Service sleeping: $(args["sleep"])$(RESET)")
|
println("$(GREEN)Service frozen: $(args["sleep"])$(RESET)")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if args["wake"] !== nothing
|
if args["wake"] !== nothing
|
||||||
api_request("/services/$(args["wake"])/wake", public_key, secret_key, method="POST")
|
api_request("/services/$(args["wake"])/unfreeze", public_key, secret_key, method="POST")
|
||||||
println("$(GREEN)Service waking: $(args["wake"])$(RESET)")
|
println("$(GREEN)Service unfreezing: $(args["wake"])$(RESET)")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
8
un.js
8
un.js
|
|
@ -679,14 +679,14 @@ async function cmdService(args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.sleep) {
|
if (args.sleep) {
|
||||||
await apiRequest(`/services/${args.sleep}/sleep`, "POST", null, publicKey, secretKey);
|
await apiRequest(`/services/${args.sleep}/freeze`, "POST", null, publicKey, secretKey);
|
||||||
console.log(`${GREEN}Service sleeping: ${args.sleep}${RESET}`);
|
console.log(`${GREEN}Service frozen: ${args.sleep}${RESET}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.wake) {
|
if (args.wake) {
|
||||||
await apiRequest(`/services/${args.wake}/wake`, "POST", null, publicKey, secretKey);
|
await apiRequest(`/services/${args.wake}/unfreeze`, "POST", null, publicKey, secretKey);
|
||||||
console.log(`${GREEN}Service waking: ${args.wake}${RESET}`);
|
console.log(`${GREEN}Service unfreezing: ${args.wake}${RESET}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.kt
8
un.kt
|
|
@ -317,14 +317,14 @@ fun cmdService(args: Args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.serviceSleep != null) {
|
if (args.serviceSleep != null) {
|
||||||
apiRequest("/services/${args.serviceSleep}/sleep", "POST", null, publicKey, secretKey)
|
apiRequest("/services/${args.serviceSleep}/freeze", "POST", null, publicKey, secretKey)
|
||||||
println("${GREEN}Service sleeping: ${args.serviceSleep}${RESET}")
|
println("${GREEN}Service frozen: ${args.serviceSleep}${RESET}")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.serviceWake != null) {
|
if (args.serviceWake != null) {
|
||||||
apiRequest("/services/${args.serviceWake}/wake", "POST", null, publicKey, secretKey)
|
apiRequest("/services/${args.serviceWake}/unfreeze", "POST", null, publicKey, secretKey)
|
||||||
println("${GREEN}Service waking: ${args.serviceWake}${RESET}")
|
println("${GREEN}Service unfreezing: ${args.serviceWake}${RESET}")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.lisp
8
un.lisp
|
|
@ -321,11 +321,11 @@
|
||||||
((string= action "logs")
|
((string= action "logs")
|
||||||
(format t "~a~%" (curl-get api-key (format nil "/services/~a/logs" id))))
|
(format t "~a~%" (curl-get api-key (format nil "/services/~a/logs" id))))
|
||||||
((string= action "sleep")
|
((string= action "sleep")
|
||||||
(curl-post api-key (format nil "/services/~a/sleep" id) "{}")
|
(curl-post api-key (format nil "/services/~a/freeze" id) "{}")
|
||||||
(format t "~aService sleeping: ~a~a~%" *green* id *reset*))
|
(format t "~aService frozen: ~a~a~%" *green* id *reset*))
|
||||||
((string= action "wake")
|
((string= action "wake")
|
||||||
(curl-post api-key (format nil "/services/~a/wake" id) "{}")
|
(curl-post api-key (format nil "/services/~a/unfreeze" id) "{}")
|
||||||
(format t "~aService waking: ~a~a~%" *green* id *reset*))
|
(format t "~aService unfreezing: ~a~a~%" *green* id *reset*))
|
||||||
((string= action "destroy")
|
((string= action "destroy")
|
||||||
(curl-delete api-key (format nil "/services/~a" id))
|
(curl-delete api-key (format nil "/services/~a" id))
|
||||||
(format t "~aService destroyed: ~a~a~%" *green* id *reset*))
|
(format t "~aService destroyed: ~a~a~%" *green* id *reset*))
|
||||||
|
|
|
||||||
8
un.lua
8
un.lua
|
|
@ -719,14 +719,14 @@ local function cmd_service(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
if options.sleep then
|
if options.sleep then
|
||||||
api_request("/services/" .. options.sleep .. "/sleep", "POST", nil, keys)
|
api_request("/services/" .. options.sleep .. "/freeze", "POST", nil, keys)
|
||||||
print(GREEN .. "Service sleeping: " .. options.sleep .. RESET)
|
print(GREEN .. "Service frozen: " .. options.sleep .. RESET)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if options.wake then
|
if options.wake then
|
||||||
api_request("/services/" .. options.wake .. "/wake", "POST", nil, keys)
|
api_request("/services/" .. options.wake .. "/unfreeze", "POST", nil, keys)
|
||||||
print(GREEN .. "Service waking: " .. options.wake .. RESET)
|
print(GREEN .. "Service unfreezing: " .. options.wake .. RESET)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
8
un.m
8
un.m
|
|
@ -818,16 +818,16 @@ void cmdService(NSArray* args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sleepId) {
|
if (sleepId) {
|
||||||
NSString* endpoint = [NSString stringWithFormat:@"/services/%@/sleep", sleepId];
|
NSString* endpoint = [NSString stringWithFormat:@"/services/%@/freeze", sleepId];
|
||||||
apiRequest(endpoint, @"POST", nil, publicKey, secretKey);
|
apiRequest(endpoint, @"POST", nil, publicKey, secretKey);
|
||||||
printf("%sService sleeping: %s%s\n", [GREEN UTF8String], [sleepId UTF8String], [RESET UTF8String]);
|
printf("%sService frozen: %s%s\n", [GREEN UTF8String], [sleepId UTF8String], [RESET UTF8String]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wakeId) {
|
if (wakeId) {
|
||||||
NSString* endpoint = [NSString stringWithFormat:@"/services/%@/wake", wakeId];
|
NSString* endpoint = [NSString stringWithFormat:@"/services/%@/unfreeze", wakeId];
|
||||||
apiRequest(endpoint, @"POST", nil, publicKey, secretKey);
|
apiRequest(endpoint, @"POST", nil, publicKey, secretKey);
|
||||||
printf("%sService waking: %s%s\n", [GREEN UTF8String], [wakeId UTF8String], [RESET UTF8String]);
|
printf("%sService unfreezing: %s%s\n", [GREEN UTF8String], [wakeId UTF8String], [RESET UTF8String]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.ml
8
un.ml
|
|
@ -647,11 +647,11 @@ let service_command action name ports bootstrap bootstrap_file service_type netw
|
||||||
let oc = open_out tmp_file in
|
let oc = open_out tmp_file in
|
||||||
output_string oc "{}";
|
output_string oc "{}";
|
||||||
close_out oc;
|
close_out oc;
|
||||||
let cmd = Printf.sprintf "curl -s -X POST https://api.unsandbox.com/services/%s/sleep -H 'Content-Type: application/json' -H 'Authorization: Bearer %s' -d @%s"
|
let cmd = Printf.sprintf "curl -s -X POST https://api.unsandbox.com/services/%s/freeze -H 'Content-Type: application/json' -H 'Authorization: Bearer %s' -d @%s"
|
||||||
sid api_key tmp_file in
|
sid api_key tmp_file in
|
||||||
let _ = Sys.command cmd in
|
let _ = Sys.command cmd in
|
||||||
Sys.remove tmp_file;
|
Sys.remove tmp_file;
|
||||||
Printf.printf "%sService sleeping: %s%s\n" green sid reset
|
Printf.printf "%sService frozen: %s%s\n" green sid reset
|
||||||
| None ->
|
| None ->
|
||||||
Printf.fprintf stderr "Error: --freeze requires service ID\n";
|
Printf.fprintf stderr "Error: --freeze requires service ID\n";
|
||||||
exit 1)
|
exit 1)
|
||||||
|
|
@ -662,11 +662,11 @@ let service_command action name ports bootstrap bootstrap_file service_type netw
|
||||||
let oc = open_out tmp_file in
|
let oc = open_out tmp_file in
|
||||||
output_string oc "{}";
|
output_string oc "{}";
|
||||||
close_out oc;
|
close_out oc;
|
||||||
let cmd = Printf.sprintf "curl -s -X POST https://api.unsandbox.com/services/%s/wake -H 'Content-Type: application/json' -H 'Authorization: Bearer %s' -d @%s"
|
let cmd = Printf.sprintf "curl -s -X POST https://api.unsandbox.com/services/%s/unfreeze -H 'Content-Type: application/json' -H 'Authorization: Bearer %s' -d @%s"
|
||||||
sid api_key tmp_file in
|
sid api_key tmp_file in
|
||||||
let _ = Sys.command cmd in
|
let _ = Sys.command cmd in
|
||||||
Sys.remove tmp_file;
|
Sys.remove tmp_file;
|
||||||
Printf.printf "%sService waking: %s%s\n" green sid reset
|
Printf.printf "%sService unfreezing: %s%s\n" green sid reset
|
||||||
| None ->
|
| None ->
|
||||||
Printf.fprintf stderr "Error: --unfreeze requires service ID\n";
|
Printf.fprintf stderr "Error: --unfreeze requires service ID\n";
|
||||||
exit 1)
|
exit 1)
|
||||||
|
|
|
||||||
12
un.nim
12
un.nim
|
|
@ -336,19 +336,19 @@ proc cmdService(name, ports, bootstrap, bootstrapFile, serviceType: string, list
|
||||||
return
|
return
|
||||||
|
|
||||||
if sleep != "":
|
if sleep != "":
|
||||||
let path = fmt"/services/{sleep}/sleep"
|
let path = fmt"/services/{sleep}/freeze"
|
||||||
let authHeaders = buildAuthHeaders("POST", path, "", publicKey, secretKey)
|
let authHeaders = buildAuthHeaders("POST", path, "", publicKey, secretKey)
|
||||||
let cmd = fmt"""curl -s -X POST '{API_BASE}/services/{sleep}/sleep' {authHeaders}"""
|
let cmd = fmt"""curl -s -X POST '{API_BASE}/services/{sleep}/freeze' {authHeaders}"""
|
||||||
discard execCurl(cmd)
|
discard execCurl(cmd)
|
||||||
echo GREEN & "Service sleeping: " & sleep & RESET
|
echo GREEN & "Service frozen: " & sleep & RESET
|
||||||
return
|
return
|
||||||
|
|
||||||
if wake != "":
|
if wake != "":
|
||||||
let path = fmt"/services/{wake}/wake"
|
let path = fmt"/services/{wake}/unfreeze"
|
||||||
let authHeaders = buildAuthHeaders("POST", path, "", publicKey, secretKey)
|
let authHeaders = buildAuthHeaders("POST", path, "", publicKey, secretKey)
|
||||||
let cmd = fmt"""curl -s -X POST '{API_BASE}/services/{wake}/wake' {authHeaders}"""
|
let cmd = fmt"""curl -s -X POST '{API_BASE}/services/{wake}/unfreeze' {authHeaders}"""
|
||||||
discard execCurl(cmd)
|
discard execCurl(cmd)
|
||||||
echo GREEN & "Service waking: " & wake & RESET
|
echo GREEN & "Service unfreezing: " & wake & RESET
|
||||||
return
|
return
|
||||||
|
|
||||||
if destroy != "":
|
if destroy != "":
|
||||||
|
|
|
||||||
8
un.php
8
un.php
|
|
@ -643,14 +643,14 @@ function cmd_service($options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options['sleep']) {
|
if ($options['sleep']) {
|
||||||
api_request("/services/{$options['sleep']}/sleep", 'POST', null, $keys);
|
api_request("/services/{$options['sleep']}/freeze", 'POST', null, $keys);
|
||||||
echo GREEN . "Service sleeping: {$options['sleep']}" . RESET . "\n";
|
echo GREEN . "Service frozen: {$options['sleep']}" . RESET . "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options['wake']) {
|
if ($options['wake']) {
|
||||||
api_request("/services/{$options['wake']}/wake", 'POST', null, $keys);
|
api_request("/services/{$options['wake']}/unfreeze", 'POST', null, $keys);
|
||||||
echo GREEN . "Service waking: {$options['wake']}" . RESET . "\n";
|
echo GREEN . "Service unfreezing: {$options['wake']}" . RESET . "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.pl
8
un.pl
|
|
@ -507,14 +507,14 @@ sub cmd_service {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options->{sleep}) {
|
if ($options->{sleep}) {
|
||||||
api_request("/services/$options->{sleep}/sleep", 'POST', undef, $public_key, $secret_key);
|
api_request("/services/$options->{sleep}/freeze", 'POST', undef, $public_key, $secret_key);
|
||||||
print "${GREEN}Service sleeping: $options->{sleep}${RESET}\n";
|
print "${GREEN}Service frozen: $options->{sleep}${RESET}\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($options->{wake}) {
|
if ($options->{wake}) {
|
||||||
api_request("/services/$options->{wake}/wake", 'POST', undef, $public_key, $secret_key);
|
api_request("/services/$options->{wake}/unfreeze", 'POST', undef, $public_key, $secret_key);
|
||||||
print "${GREEN}Service waking: $options->{wake}${RESET}\n";
|
print "${GREEN}Service unfreezing: $options->{wake}${RESET}\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
4
un.pro
4
un.pro
|
|
@ -208,7 +208,7 @@ service_sleep(ServiceId) :-
|
||||||
get_public_key(PublicKey),
|
get_public_key(PublicKey),
|
||||||
get_secret_key(SecretKey),
|
get_secret_key(SecretKey),
|
||||||
format(atom(Cmd),
|
format(atom(Cmd),
|
||||||
'TIMESTAMP=$(date +%s); MESSAGE="$TIMESTAMP:POST:/services/~w/sleep:"; SIGNATURE=$(echo -n "$MESSAGE" | openssl dgst -sha256 -hmac "~w" -hex | sed \'\'s/.*= //\'\'); curl -s -X POST https://api.unsandbox.com/services/~w/sleep -H "Authorization: Bearer ~w" -H "X-Timestamp: $TIMESTAMP" -H "X-Signature: $SIGNATURE" >/dev/null && echo -e "\\x1b[32mService sleeping: ~w\\x1b[0m"',
|
'TIMESTAMP=$(date +%s); MESSAGE="$TIMESTAMP:POST:/services/~w/freeze:"; SIGNATURE=$(echo -n "$MESSAGE" | openssl dgst -sha256 -hmac "~w" -hex | sed \'\'s/.*= //\'\'); curl -s -X POST https://api.unsandbox.com/services/~w/freeze -H "Authorization: Bearer ~w" -H "X-Timestamp: $TIMESTAMP" -H "X-Signature: $SIGNATURE" >/dev/null && echo -e "\\x1b[32mService frozen: ~w\\x1b[0m"',
|
||||||
[ServiceId, SecretKey, ServiceId, PublicKey, ServiceId]),
|
[ServiceId, SecretKey, ServiceId, PublicKey, ServiceId]),
|
||||||
shell(Cmd, 0).
|
shell(Cmd, 0).
|
||||||
|
|
||||||
|
|
@ -217,7 +217,7 @@ service_wake(ServiceId) :-
|
||||||
get_public_key(PublicKey),
|
get_public_key(PublicKey),
|
||||||
get_secret_key(SecretKey),
|
get_secret_key(SecretKey),
|
||||||
format(atom(Cmd),
|
format(atom(Cmd),
|
||||||
'TIMESTAMP=$(date +%s); MESSAGE="$TIMESTAMP:POST:/services/~w/wake:"; SIGNATURE=$(echo -n "$MESSAGE" | openssl dgst -sha256 -hmac "~w" -hex | sed \'\'s/.*= //\'\'); curl -s -X POST https://api.unsandbox.com/services/~w/wake -H "Authorization: Bearer ~w" -H "X-Timestamp: $TIMESTAMP" -H "X-Signature: $SIGNATURE" >/dev/null && echo -e "\\x1b[32mService waking: ~w\\x1b[0m"',
|
'TIMESTAMP=$(date +%s); MESSAGE="$TIMESTAMP:POST:/services/~w/unfreeze:"; SIGNATURE=$(echo -n "$MESSAGE" | openssl dgst -sha256 -hmac "~w" -hex | sed \'\'s/.*= //\'\'); curl -s -X POST https://api.unsandbox.com/services/~w/unfreeze -H "Authorization: Bearer ~w" -H "X-Timestamp: $TIMESTAMP" -H "X-Signature: $SIGNATURE" >/dev/null && echo -e "\\x1b[32mService unfreezing: ~w\\x1b[0m"',
|
||||||
[ServiceId, SecretKey, ServiceId, PublicKey, ServiceId]),
|
[ServiceId, SecretKey, ServiceId, PublicKey, ServiceId]),
|
||||||
shell(Cmd, 0).
|
shell(Cmd, 0).
|
||||||
|
|
||||||
|
|
|
||||||
8
un.ps1
8
un.ps1
|
|
@ -518,16 +518,16 @@ function Invoke-Service {
|
||||||
if ($Args -contains "--freeze") {
|
if ($Args -contains "--freeze") {
|
||||||
$idx = [array]::IndexOf($Args, "--freeze")
|
$idx = [array]::IndexOf($Args, "--freeze")
|
||||||
$serviceId = $Args[$idx + 1]
|
$serviceId = $Args[$idx + 1]
|
||||||
Invoke-Api -Endpoint "/services/$serviceId/sleep" -Method "POST" -Body "{}"
|
Invoke-Api -Endpoint "/services/$serviceId/freeze" -Method "POST" -Body "{}"
|
||||||
Write-Host "`e[32mService sleeping: $serviceId`e[0m"
|
Write-Host "`e[32mService frozen: $serviceId`e[0m"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Args -contains "--unfreeze") {
|
if ($Args -contains "--unfreeze") {
|
||||||
$idx = [array]::IndexOf($Args, "--unfreeze")
|
$idx = [array]::IndexOf($Args, "--unfreeze")
|
||||||
$serviceId = $Args[$idx + 1]
|
$serviceId = $Args[$idx + 1]
|
||||||
Invoke-Api -Endpoint "/services/$serviceId/wake" -Method "POST" -Body "{}"
|
Invoke-Api -Endpoint "/services/$serviceId/unfreeze" -Method "POST" -Body "{}"
|
||||||
Write-Host "`e[32mService waking: $serviceId`e[0m"
|
Write-Host "`e[32mService unfreezing: $serviceId`e[0m"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
un.py
12
un.py
|
|
@ -730,13 +730,13 @@ def cmd_service(args):
|
||||||
return
|
return
|
||||||
|
|
||||||
if args.sleep:
|
if args.sleep:
|
||||||
result = api_request(f"/services/{args.sleep}/sleep", method="POST", public_key=public_key, secret_key=secret_key)
|
result = api_request(f"/services/{args.sleep}/freeze", method="POST", public_key=public_key, secret_key=secret_key)
|
||||||
print(f"{GREEN}Service sleeping: {args.sleep}{RESET}")
|
print(f"{GREEN}Service frozen: {args.sleep}{RESET}")
|
||||||
return
|
return
|
||||||
|
|
||||||
if args.wake:
|
if args.wake:
|
||||||
result = api_request(f"/services/{args.wake}/wake", method="POST", public_key=public_key, secret_key=secret_key)
|
result = api_request(f"/services/{args.wake}/unfreeze", method="POST", public_key=public_key, secret_key=secret_key)
|
||||||
print(f"{GREEN}Service waking: {args.wake}{RESET}")
|
print(f"{GREEN}Service unfreezing: {args.wake}{RESET}")
|
||||||
return
|
return
|
||||||
|
|
||||||
if args.destroy:
|
if args.destroy:
|
||||||
|
|
@ -934,8 +934,8 @@ Examples:
|
||||||
service_parser.add_argument("--info", metavar="ID", help="Get service details")
|
service_parser.add_argument("--info", metavar="ID", help="Get service details")
|
||||||
service_parser.add_argument("--tail", metavar="ID", help="Get last 9000 lines of logs")
|
service_parser.add_argument("--tail", metavar="ID", help="Get last 9000 lines of logs")
|
||||||
service_parser.add_argument("--logs", metavar="ID", help="Get all logs")
|
service_parser.add_argument("--logs", metavar="ID", help="Get all logs")
|
||||||
service_parser.add_argument("--freeze", "--sleep", dest="sleep", metavar="ID", help="Freeze service")
|
service_parser.add_argument("--freeze", "--freeze", dest="sleep", metavar="ID", help="Freeze service")
|
||||||
service_parser.add_argument("--unfreeze", "--wake", dest="wake", metavar="ID", help="Unfreeze service")
|
service_parser.add_argument("--unfreeze", "--unfreeze", dest="wake", metavar="ID", help="Unfreeze service")
|
||||||
service_parser.add_argument("--destroy", metavar="ID", help="Destroy service")
|
service_parser.add_argument("--destroy", metavar="ID", help="Destroy service")
|
||||||
service_parser.add_argument("--resize", metavar="ID", help="Resize service vCPU/memory")
|
service_parser.add_argument("--resize", metavar="ID", help="Resize service vCPU/memory")
|
||||||
service_parser.add_argument("--snapshot", metavar="SERVICE_ID", help="Create snapshot of service")
|
service_parser.add_argument("--snapshot", metavar="SERVICE_ID", help="Create snapshot of service")
|
||||||
|
|
|
||||||
8
un.r
8
un.r
|
|
@ -695,14 +695,14 @@ cmd_service <- function(args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is.null(args$sleep)) {
|
if (!is.null(args$sleep)) {
|
||||||
result <- api_request(paste0("/services/", args$sleep, "/sleep"), public_key, secret_key, method = "POST")
|
result <- api_request(paste0("/services/", args$sleep, "/freeze"), public_key, secret_key, method = "POST")
|
||||||
cat(sprintf("%sService sleeping: %s%s\n", GREEN, args$sleep, RESET))
|
cat(sprintf("%sService frozen: %s%s\n", GREEN, args$sleep, RESET))
|
||||||
return()
|
return()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is.null(args$wake)) {
|
if (!is.null(args$wake)) {
|
||||||
result <- api_request(paste0("/services/", args$wake, "/wake"), public_key, secret_key, method = "POST")
|
result <- api_request(paste0("/services/", args$wake, "/unfreeze"), public_key, secret_key, method = "POST")
|
||||||
cat(sprintf("%sService waking: %s%s\n", GREEN, args$wake, RESET))
|
cat(sprintf("%sService unfreezing: %s%s\n", GREEN, args$wake, RESET))
|
||||||
return()
|
return()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.raku
8
un.raku
|
|
@ -625,14 +625,14 @@ sub cmd-service(@args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if $sleep-id {
|
if $sleep-id {
|
||||||
api-request("/services/$sleep-id/sleep", 'POST', :$public-key, :$secret-key);
|
api-request("/services/$sleep-id/freeze", 'POST', :$public-key, :$secret-key);
|
||||||
say "{$GREEN}Service sleeping: $sleep-id{$RESET}";
|
say "{$GREEN}Service frozen: $sleep-id{$RESET}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if $wake-id {
|
if $wake-id {
|
||||||
api-request("/services/$wake-id/wake", 'POST', :$public-key, :$secret-key);
|
api-request("/services/$wake-id/unfreeze", 'POST', :$public-key, :$secret-key);
|
||||||
say "{$GREEN}Service waking: $wake-id{$RESET}";
|
say "{$GREEN}Service unfreezing: $wake-id{$RESET}";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.rb
8
un.rb
|
|
@ -662,14 +662,14 @@ def cmd_service(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
if options[:sleep]
|
if options[:sleep]
|
||||||
api_request("/services/#{options[:sleep]}/sleep", method: 'POST', keys: keys)
|
api_request("/services/#{options[:sleep]}/freeze", method: 'POST', keys: keys)
|
||||||
puts "#{GREEN}Service sleeping: #{options[:sleep]}#{RESET}"
|
puts "#{GREEN}Service frozen: #{options[:sleep]}#{RESET}"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if options[:wake]
|
if options[:wake]
|
||||||
api_request("/services/#{options[:wake]}/wake", method: 'POST', keys: keys)
|
api_request("/services/#{options[:wake]}/unfreeze", method: 'POST', keys: keys)
|
||||||
puts "#{GREEN}Service waking: #{options[:wake]}#{RESET}"
|
puts "#{GREEN}Service unfreezing: #{options[:wake]}#{RESET}"
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
8
un.rs
8
un.rs
|
|
@ -616,14 +616,14 @@ fn cmd_service(
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(id) = sleep {
|
if let Some(id) = sleep {
|
||||||
api_request(&format!("/services/{}/sleep", id), "POST", None, public_key, secret_key);
|
api_request(&format!("/services/{}/freeze", id), "POST", None, public_key, secret_key);
|
||||||
println!("{}Service sleeping: {}{}", GREEN, id, RESET);
|
println!("{}Service frozen: {}{}", GREEN, id, RESET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(id) = wake {
|
if let Some(id) = wake {
|
||||||
api_request(&format!("/services/{}/wake", id), "POST", None, public_key, secret_key);
|
api_request(&format!("/services/{}/unfreeze", id), "POST", None, public_key, secret_key);
|
||||||
println!("{}Service waking: {}{}", GREEN, id, RESET);
|
println!("{}Service unfreezing: {}{}", GREEN, id, RESET);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.scm
8
un.scm
|
|
@ -479,11 +479,11 @@
|
||||||
(display (curl-get api-key (format #f "/services/~a/logs" id)))
|
(display (curl-get api-key (format #f "/services/~a/logs" id)))
|
||||||
(newline))
|
(newline))
|
||||||
((equal? action "sleep")
|
((equal? action "sleep")
|
||||||
(curl-post api-key (format #f "/services/~a/sleep" id) "{}")
|
(curl-post api-key (format #f "/services/~a/freeze" id) "{}")
|
||||||
(format #t "~aService sleeping: ~a~a\n" green id reset))
|
(format #t "~aService frozen: ~a~a\n" green id reset))
|
||||||
((equal? action "wake")
|
((equal? action "wake")
|
||||||
(curl-post api-key (format #f "/services/~a/wake" id) "{}")
|
(curl-post api-key (format #f "/services/~a/unfreeze" id) "{}")
|
||||||
(format #t "~aService waking: ~a~a\n" green id reset))
|
(format #t "~aService unfreezing: ~a~a\n" green id reset))
|
||||||
((equal? action "destroy")
|
((equal? action "destroy")
|
||||||
(curl-delete api-key (format #f "/services/~a" id))
|
(curl-delete api-key (format #f "/services/~a" id))
|
||||||
(format #t "~aService destroyed: ~a~a\n" green id reset))
|
(format #t "~aService destroyed: ~a~a\n" green id reset))
|
||||||
|
|
|
||||||
8
un.sh
8
un.sh
|
|
@ -970,14 +970,14 @@ cmd_service() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$sleep" ]]; then
|
if [[ -n "$sleep" ]]; then
|
||||||
api_request "/services/$sleep/sleep" "POST" "" "$api_key" > /dev/null
|
api_request "/services/$sleep/freeze" "POST" "" "$api_key" > /dev/null
|
||||||
echo -e "${GREEN}Service sleeping: $sleep${RESET}"
|
echo -e "${GREEN}Service frozen: $sleep${RESET}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$wake" ]]; then
|
if [[ -n "$wake" ]]; then
|
||||||
api_request "/services/$wake/wake" "POST" "" "$api_key" > /dev/null
|
api_request "/services/$wake/unfreeze" "POST" "" "$api_key" > /dev/null
|
||||||
echo -e "${GREEN}Service waking: $wake${RESET}"
|
echo -e "${GREEN}Service unfreezing: $wake${RESET}"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
8
un.tcl
8
un.tcl
|
|
@ -830,14 +830,14 @@ proc cmd_service {args} {
|
||||||
}
|
}
|
||||||
|
|
||||||
if {$sleep_id ne ""} {
|
if {$sleep_id ne ""} {
|
||||||
api_request "/services/$sleep_id/sleep" "POST" {} $public_key $secret_key
|
api_request "/services/$sleep_id/freeze" "POST" {} $public_key $secret_key
|
||||||
puts "${::GREEN}Service sleeping: $sleep_id${::RESET}"
|
puts "${::GREEN}Service frozen: $sleep_id${::RESET}"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if {$wake_id ne ""} {
|
if {$wake_id ne ""} {
|
||||||
api_request "/services/$wake_id/wake" "POST" {} $public_key $secret_key
|
api_request "/services/$wake_id/unfreeze" "POST" {} $public_key $secret_key
|
||||||
puts "${::GREEN}Service waking: $wake_id${::RESET}"
|
puts "${::GREEN}Service unfreezing: $wake_id${::RESET}"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.ts
8
un.ts
|
|
@ -610,14 +610,14 @@ async function cmdService(args: Args): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.sleep) {
|
if (args.sleep) {
|
||||||
await apiRequest(`/services/${args.sleep}/sleep`, "POST", null, keys);
|
await apiRequest(`/services/${args.sleep}/freeze`, "POST", null, keys);
|
||||||
console.log(`${GREEN}Service sleeping: ${args.sleep}${RESET}`);
|
console.log(`${GREEN}Service frozen: ${args.sleep}${RESET}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.wake) {
|
if (args.wake) {
|
||||||
await apiRequest(`/services/${args.wake}/wake`, "POST", null, keys);
|
await apiRequest(`/services/${args.wake}/unfreeze`, "POST", null, keys);
|
||||||
console.log(`${GREEN}Service waking: ${args.wake}${RESET}`);
|
console.log(`${GREEN}Service unfreezing: ${args.wake}${RESET}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
8
un.v
8
un.v
|
|
@ -439,16 +439,16 @@ fn cmd_service(name string, ports string, service_type string, bootstrap string,
|
||||||
}
|
}
|
||||||
|
|
||||||
if sleep != '' {
|
if sleep != '' {
|
||||||
cmd := "TIMESTAMP=\$(date +%s); MESSAGE=\"\$TIMESTAMP:POST:/services/${sleep}/sleep:\"; SIGNATURE=\$(echo -n \"\$MESSAGE\" | openssl dgst -sha256 -hmac '${secret_key}' -hex | sed 's/.*= //'); curl -s -X POST '${api_base}/services/${sleep}/sleep' -H 'Authorization: Bearer ${pub_key}' -H \"X-Timestamp: \$TIMESTAMP\" -H \"X-Signature: \$SIGNATURE\""
|
cmd := "TIMESTAMP=\$(date +%s); MESSAGE=\"\$TIMESTAMP:POST:/services/${sleep}/freeze:\"; SIGNATURE=\$(echo -n \"\$MESSAGE\" | openssl dgst -sha256 -hmac '${secret_key}' -hex | sed 's/.*= //'); curl -s -X POST '${api_base}/services/${sleep}/freeze' -H 'Authorization: Bearer ${pub_key}' -H \"X-Timestamp: \$TIMESTAMP\" -H \"X-Signature: \$SIGNATURE\""
|
||||||
exec_curl(cmd)
|
exec_curl(cmd)
|
||||||
println('${green}Service sleeping: ${sleep}${reset}')
|
println('${green}Service frozen: ${sleep}${reset}')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if wake != '' {
|
if wake != '' {
|
||||||
cmd := "TIMESTAMP=\$(date +%s); MESSAGE=\"\$TIMESTAMP:POST:/services/${wake}/wake:\"; SIGNATURE=\$(echo -n \"\$MESSAGE\" | openssl dgst -sha256 -hmac '${secret_key}' -hex | sed 's/.*= //'); curl -s -X POST '${api_base}/services/${wake}/wake' -H 'Authorization: Bearer ${pub_key}' -H \"X-Timestamp: \$TIMESTAMP\" -H \"X-Signature: \$SIGNATURE\""
|
cmd := "TIMESTAMP=\$(date +%s); MESSAGE=\"\$TIMESTAMP:POST:/services/${wake}/unfreeze:\"; SIGNATURE=\$(echo -n \"\$MESSAGE\" | openssl dgst -sha256 -hmac '${secret_key}' -hex | sed 's/.*= //'); curl -s -X POST '${api_base}/services/${wake}/unfreeze' -H 'Authorization: Bearer ${pub_key}' -H \"X-Timestamp: \$TIMESTAMP\" -H \"X-Signature: \$SIGNATURE\""
|
||||||
exec_curl(cmd)
|
exec_curl(cmd)
|
||||||
println('${green}Service waking: ${wake}${reset}')
|
println('${green}Service unfreezing: ${wake}${reset}')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -549,13 +549,13 @@ async function cmdService(args: string[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sleepId) {
|
if (sleepId) {
|
||||||
await apiRequest(`/services/${sleepId}/sleep`, "POST", undefined, keys);
|
await apiRequest(`/services/${sleepId}/freeze`, "POST", undefined, keys);
|
||||||
console.log(`${GREEN}Service sleeping: ${sleepId}${RESET}`);
|
console.log(`${GREEN}Service sleeping: ${sleepId}${RESET}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wakeId) {
|
if (wakeId) {
|
||||||
await apiRequest(`/services/${wakeId}/wake`, "POST", undefined, keys);
|
await apiRequest(`/services/${wakeId}/unfreeze`, "POST", undefined, keys);
|
||||||
console.log(`${GREEN}Service waking: ${wakeId}${RESET}`);
|
console.log(`${GREEN}Service waking: ${wakeId}${RESET}`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue