feat: add unfreeze_on_demand support to all SDKs

Updated Python, JavaScript, Go, Rust, Ruby, Java, and TypeScript SDKs:
- Add unfreeze_on_demand field to Service struct/class
- Add setUnfreezeOnDemand function to toggle setting via PATCH /services/:id
- Add unfreeze_on_demand parameter to createService function
This commit is contained in:
russell@unturf.com 2026-01-22 16:40:36 -05:00
parent 04060aa4da
commit e58adcd5fe
13 changed files with 435 additions and 10 deletions

View file

@ -316,6 +316,9 @@ pub struct Service {
/// Whether the service is locked (cannot be modified)
#[serde(default)]
pub locked: bool,
/// Whether the service automatically unfreezes on incoming HTTP requests
#[serde(default)]
pub unfreeze_on_demand: bool,
/// Public URL for the service
#[serde(default)]
pub url: String,
@ -382,6 +385,8 @@ pub struct ServiceCreateOptions {
pub bootstrap: Option<String>,
/// Bootstrap script URL
pub bootstrap_url: Option<String>,
/// Whether to enable automatic unfreezing on incoming HTTP requests
pub unfreeze_on_demand: Option<bool>,
}
/// Options for updating a service
@ -1500,6 +1505,9 @@ pub async fn create_service(
if let Some(bootstrap_url) = opts.bootstrap_url {
body["bootstrap_url"] = serde_json::json!(bootstrap_url);
}
if let Some(unfreeze_on_demand) = opts.unfreeze_on_demand {
body["unfreeze_on_demand"] = serde_json::json!(unfreeze_on_demand);
}
}
make_request("POST", "/services", creds, Some(&body)).await
@ -1618,6 +1626,26 @@ pub async fn unlock_service(service_id: &str, creds: &Credentials) -> Result<Ser
make_request("POST", &path, creds, Some(&body)).await
}
/// Set the unfreeze_on_demand flag for a service.
///
/// When enabled, the service will automatically unfreeze when it receives
/// an incoming HTTP request while frozen.
///
/// # Arguments
/// * `service_id` - Service ID to update
/// * `enabled` - Whether to enable automatic unfreezing on demand
/// * `creds` - API credentials
///
/// # Returns
/// Updated Service information
pub async fn set_unfreeze_on_demand(service_id: &str, enabled: bool, creds: &Credentials) -> Result<Service> {
let path = format!("/services/{}", service_id);
let body = serde_json::json!({
"unfreeze_on_demand": enabled
});
make_request("PATCH", &path, creds, Some(&body)).await
}
/// Get bootstrap logs for a service.
///
/// # Arguments

View file

@ -311,6 +311,9 @@ pub struct Service {
/// Whether the service is locked (cannot be modified)
#[serde(default)]
pub locked: bool,
/// Whether the service automatically unfreezes on incoming HTTP requests
#[serde(default)]
pub unfreeze_on_demand: bool,
/// Public URL for the service
#[serde(default)]
pub url: String,
@ -377,6 +380,8 @@ pub struct ServiceCreateOptions {
pub bootstrap: Option<String>,
/// Bootstrap script URL
pub bootstrap_url: Option<String>,
/// Whether to enable automatic unfreezing on incoming HTTP requests
pub unfreeze_on_demand: Option<bool>,
}
/// Options for updating a service
@ -1807,6 +1812,9 @@ pub fn create_service(
if let Some(bootstrap_url) = opts.bootstrap_url {
body["bootstrap_url"] = serde_json::json!(bootstrap_url);
}
if let Some(unfreeze_on_demand) = opts.unfreeze_on_demand {
body["unfreeze_on_demand"] = serde_json::json!(unfreeze_on_demand);
}
}
make_request("POST", "/services", creds, Some(&body))
@ -1925,6 +1933,26 @@ pub fn unlock_service(service_id: &str, creds: &Credentials) -> Result<Service>
make_request("POST", &path, creds, Some(&body))
}
/// Set the unfreeze_on_demand flag for a service.
///
/// When enabled, the service will automatically unfreeze when it receives
/// an incoming HTTP request while frozen.
///
/// # Arguments
/// * `service_id` - Service ID to update
/// * `enabled` - Whether to enable automatic unfreezing on demand
/// * `creds` - API credentials
///
/// # Returns
/// Updated Service information
pub fn set_unfreeze_on_demand(service_id: &str, enabled: bool, creds: &Credentials) -> Result<Service> {
let path = format!("/services/{}", service_id);
let body = serde_json::json!({
"unfreeze_on_demand": enabled
});
make_request("PATCH", &path, creds, Some(&body))
}
/// Get bootstrap logs for a service.
///
/// # Arguments