Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions crates/clickhouse-cloud-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,33 @@ The beta `organization_public_previews_get_list` method lists the organization's

Every `Client` method sends each path parameter (organization, service, key, pipe or provider ID, UDF or setting name) as one percent-encoded URL segment, so `/`, `?`, `#` or `%` in an ID can no longer change the request path; the API answers 400 or 404 for a malformed ID instead. The same applies to the service ID in the Query API URLs. A parameter that is empty, `.` or `..` cannot be one segment, because URL parsing drops or resolves it, so the method returns `Error::InvalidPathParameter` without sending a request. Each method takes its HTTP method and path template from its generated `meta::operations` descriptor.

`Service`, `ServiceScalingPatchResponse`, `ServicePostRequest` and
`ServicePatchRequest` gain optional `deletion_protection` (`deletionProtection`,
a `bool`). While it is `true`, `instance_delete` fails with
`Error::Api { status: 409, .. }` until it is turned off. Setting it on create
requires `control-plane:service:delete` for all services in the organization;
changing it on update requires `control-plane:service:delete` on the service.
`ServicePostRequest::new` leaves it `None`. Struct-literal callers need
`deletion_protection: None` or `..Default::default()` (PATCH body only).
`ActivityType` adds `Service_update_deletion_protection`. The spec now types
`Activity.type` as an open string and lists the known values in its
description; `ActivityType` keeps those values as variants, and any other value
still lands in `ActivityType::Unknown`.

The twelve UDF operations in `meta::operations` (`UDF_CREATE`, `UDF_GET`,
`UDF_ATTACH` and the rest) now require the dedicated
`control-plane:organization:manage-udfs` and
`control-plane:organization:view-udfs` permissions instead of
`control-plane:organization:manage` and `control-plane:organization:view`.

The spec now types `settings` in `ClickPipePostRequest` and
`ClickPipePatchRequest` as `ClickPipeSettingsPutRequest`, the schema the
settings PUT already took, so both fields are now
`Option<ClickPipeSettingsPutRequest>`. The two structs had the same fields, so
the request body is unchanged, and `ClickPipeSettings` remains as a type alias
of `ClickPipeSettingsPutRequest`: existing code compiles unchanged. Responses
still use `ClickPipeSettingsResponse`.

## 0.5.1

No changes to this crate; released in lockstep with `clickhousectl` 0.5.1.
Expand Down
537 changes: 203 additions & 334 deletions crates/clickhouse-cloud-api/clickhouse_cloud_openapi.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions crates/clickhouse-cloud-api/src/meta/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1533,7 +1533,7 @@ pub const UDF_ATTACH: OperationMetadata = OperationMetadata {
rust_method: "udf_attach",
method: "PUT",
path: "/v1/organizations/{organizationId}/udfs/{functionName}/attachments/{serviceId}",
required_permissions: &["control-plane:organization:manage"],
required_permissions: &["control-plane:organization:manage-udfs"],
};

/// `GET /v1/organizations/{organizationId}/udfs/{functionName}/attachments/{serviceId}` (`udfAttachmentGet`).
Expand All @@ -1542,7 +1542,7 @@ pub const UDF_ATTACHMENT_GET: OperationMetadata = OperationMetadata {
rust_method: "udf_attachment_get",
method: "GET",
path: "/v1/organizations/{organizationId}/udfs/{functionName}/attachments/{serviceId}",
required_permissions: &["control-plane:organization:view"],
required_permissions: &["control-plane:organization:view-udfs"],
};

/// `GET /v1/organizations/{organizationId}/udfs/{functionName}/attachments` (`udfAttachmentList`).
Expand All @@ -1551,7 +1551,7 @@ pub const UDF_ATTACHMENT_LIST: OperationMetadata = OperationMetadata {
rust_method: "udf_attachment_list",
method: "GET",
path: "/v1/organizations/{organizationId}/udfs/{functionName}/attachments",
required_permissions: &["control-plane:organization:view"],
required_permissions: &["control-plane:organization:view-udfs"],
};

/// `POST /v1/organizations/{organizationId}/udfs` (`udfCreate`).
Expand All @@ -1560,7 +1560,7 @@ pub const UDF_CREATE: OperationMetadata = OperationMetadata {
rust_method: "udf_create",
method: "POST",
path: "/v1/organizations/{organizationId}/udfs",
required_permissions: &["control-plane:organization:manage"],
required_permissions: &["control-plane:organization:manage-udfs"],
};

/// `DELETE /v1/organizations/{organizationId}/udfs/{functionName}` (`udfDelete`).
Expand All @@ -1569,7 +1569,7 @@ pub const UDF_DELETE: OperationMetadata = OperationMetadata {
rust_method: "udf_delete",
method: "DELETE",
path: "/v1/organizations/{organizationId}/udfs/{functionName}",
required_permissions: &["control-plane:organization:manage"],
required_permissions: &["control-plane:organization:manage-udfs"],
};

/// `DELETE /v1/organizations/{organizationId}/udfs/{functionName}/attachments/{serviceId}` (`udfDetach`).
Expand All @@ -1578,7 +1578,7 @@ pub const UDF_DETACH: OperationMetadata = OperationMetadata {
rust_method: "udf_detach",
method: "DELETE",
path: "/v1/organizations/{organizationId}/udfs/{functionName}/attachments/{serviceId}",
required_permissions: &["control-plane:organization:manage"],
required_permissions: &["control-plane:organization:manage-udfs"],
};

/// `GET /v1/organizations/{organizationId}/udfs/{functionName}` (`udfGet`).
Expand All @@ -1587,7 +1587,7 @@ pub const UDF_GET: OperationMetadata = OperationMetadata {
rust_method: "udf_get",
method: "GET",
path: "/v1/organizations/{organizationId}/udfs/{functionName}",
required_permissions: &["control-plane:organization:view"],
required_permissions: &["control-plane:organization:view-udfs"],
};

/// `GET /v1/organizations/{organizationId}/udfs` (`udfList`).
Expand All @@ -1596,7 +1596,7 @@ pub const UDF_LIST: OperationMetadata = OperationMetadata {
rust_method: "udf_list",
method: "GET",
path: "/v1/organizations/{organizationId}/udfs",
required_permissions: &["control-plane:organization:view"],
required_permissions: &["control-plane:organization:view-udfs"],
};

/// `POST /v1/organizations/{organizationId}/udfUploads/url` (`udfUploadSessionCreate`).
Expand All @@ -1605,7 +1605,7 @@ pub const UDF_UPLOAD_SESSION_CREATE: OperationMetadata = OperationMetadata {
rust_method: "udf_upload_session_create",
method: "POST",
path: "/v1/organizations/{organizationId}/udfUploads/url",
required_permissions: &["control-plane:organization:manage"],
required_permissions: &["control-plane:organization:manage-udfs"],
};

/// `POST /v1/organizations/{organizationId}/udfs/{functionName}/versions` (`udfVersionCreate`).
Expand All @@ -1614,7 +1614,7 @@ pub const UDF_VERSION_CREATE: OperationMetadata = OperationMetadata {
rust_method: "udf_version_create",
method: "POST",
path: "/v1/organizations/{organizationId}/udfs/{functionName}/versions",
required_permissions: &["control-plane:organization:manage"],
required_permissions: &["control-plane:organization:manage-udfs"],
};

/// `DELETE /v1/organizations/{organizationId}/udfs/{functionName}/versions/{version}` (`udfVersionDelete`).
Expand All @@ -1623,7 +1623,7 @@ pub const UDF_VERSION_DELETE: OperationMetadata = OperationMetadata {
rust_method: "udf_version_delete",
method: "DELETE",
path: "/v1/organizations/{organizationId}/udfs/{functionName}/versions/{version}",
required_permissions: &["control-plane:organization:manage"],
required_permissions: &["control-plane:organization:manage-udfs"],
};

/// `GET /v1/organizations/{organizationId}/udfs/{functionName}/versions` (`udfVersionList`).
Expand All @@ -1632,7 +1632,7 @@ pub const UDF_VERSION_LIST: OperationMetadata = OperationMetadata {
rust_method: "udf_version_list",
method: "GET",
path: "/v1/organizations/{organizationId}/udfs/{functionName}/versions",
required_permissions: &["control-plane:organization:view"],
required_permissions: &["control-plane:organization:view-udfs"],
};

/// `DELETE /v1/organizations/{organizationId}/services/{serviceId}/upgradeWindow` (`upgradeWindowDelete`).
Expand Down
11 changes: 10 additions & 1 deletion crates/clickhouse-cloud-api/src/models/activity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ impl std::fmt::Display for ActivityKeyupdatetype {
}
}

/// Inline enum for `Activity.type`.
/// Known values of `Activity.type`.
///
/// The spec types the field as an open string and lists these values in its
/// description ("New values may be added; treat unknown values as valid"), so
/// any other value deserializes into [`ActivityType::Unknown`].
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub enum ActivityType {
#[serde(rename = "create_organization")]
Expand Down Expand Up @@ -186,6 +190,8 @@ pub enum ActivityType {
Service_maintenance_end,
#[serde(rename = "service_update_core_dump")]
Service_update_core_dump,
#[serde(rename = "service_update_deletion_protection")]
Service_update_deletion_protection,
#[serde(rename = "backup_delete")]
Backup_delete,
#[serde(rename = "backup_bucket_archive")]
Expand Down Expand Up @@ -426,6 +432,9 @@ impl std::fmt::Display for ActivityType {
Self::Service_maintenance_start => write!(f, "service_maintenance_start"),
Self::Service_maintenance_end => write!(f, "service_maintenance_end"),
Self::Service_update_core_dump => write!(f, "service_update_core_dump"),
Self::Service_update_deletion_protection => {
write!(f, "service_update_deletion_protection")
}
Self::Backup_delete => write!(f, "backup_delete"),
Self::Backup_bucket_archive => write!(f, "backup_bucket_archive"),
Self::Backup_bucket_create => write!(f, "backup_bucket_create"),
Expand Down
55 changes: 13 additions & 42 deletions crates/clickhouse-cloud-api/src/models/clickpipes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ pub struct ClickPipePatchRequest {
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub settings: Option<ClickPipeSettings>,
pub settings: Option<ClickPipeSettingsPutRequest>,
#[serde(skip_serializing_if = "Option::is_none")]
pub source: Option<ClickPipePatchSource>,
}
Expand Down Expand Up @@ -349,7 +349,7 @@ pub struct ClickPipePostRequest {
pub scaling: Option<ClickPipeScaling>,
// settings default-serializes as `{}` which the API also rejects.
#[serde(skip_serializing_if = "Option::is_none")]
pub settings: Option<ClickPipeSettings>,
pub settings: Option<ClickPipeSettingsPutRequest>,
pub source: ClickPipePostSource,
/// Create stopped and start ingestion later; unsupported for database ClickPipes.
#[serde(rename = "startPaused", skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -446,47 +446,18 @@ pub struct ClickPipeScalingPatchRequest {
pub replicas: Option<i64>,
}

/// `ClickPipeSettings` from the ClickHouse Cloud API.
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct ClickPipeSettings {
#[serde(skip_serializing_if = "Option::is_none")]
pub clickhouse_max_download_threads: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub clickhouse_max_insert_threads: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub clickhouse_max_threads: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub clickhouse_min_insert_block_size_bytes: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub clickhouse_parallel_distributed_insert_select: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub clickhouse_parallel_view_processing: Option<bool>,
// The control plane rejected this key on an object-storage create on
// 2026-09-05, even when false. It must be absent outside Kafka creates.
#[serde(
rename = "kafka_read_committed",
skip_serializing_if = "Option::is_none"
)]
pub kafka_read_committed: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub object_storage_concurrency: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub object_storage_max_file_count: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub object_storage_max_file_size: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub object_storage_max_insert_bytes: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub object_storage_polling_interval_ms: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub object_storage_use_cluster_function: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub streaming_max_insert_wait_ms: Option<i64>,
}
/// Former request-position name for ClickPipe settings.
///
/// The spec now types `settings` in [`ClickPipePostRequest`] and
/// [`ClickPipePatchRequest`] as `ClickPipeSettingsPutRequest`, leaving the
/// `ClickPipeSettings` schema response-only ([`ClickPipeSettingsResponse`]).
/// The two request structs had identical fields, so this alias keeps existing
/// callers compiling with an unchanged wire body.
pub type ClickPipeSettings = ClickPipeSettingsPutRequest;

/// `ClickPipeSettings` from the ClickHouse Cloud API, in response position.
///
/// Response variant of [`ClickPipeSettings`]: every field is `Option<T>`, so a
/// Every field is `Option<T>`, so a
/// field the API drops or sends as `null` deserializes to `None` instead of
/// failing.
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
Expand Down Expand Up @@ -541,8 +512,8 @@ pub struct ClickPipeSettingsPutRequest {
pub clickhouse_parallel_view_processing: Option<bool>,
/// Kafka-only: the API rejects this key outright for any other source
/// ("Setting 'kafka_read_committed' is only supported for Kafka
/// ClickPipes"), so absence — not `false` — is how a non-Kafka settings
/// update expresses "this setting does not apply".
/// ClickPipes"), so absence — not `false` — is how a non-Kafka create,
/// PATCH or settings update expresses "this setting does not apply".
#[serde(
rename = "kafka_read_committed",
skip_serializing_if = "Option::is_none"
Expand Down
23 changes: 23 additions & 0 deletions crates/clickhouse-cloud-api/src/models/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1540,6 +1540,10 @@ pub struct Service {
pub current_scaling: Option<CurrentScaling>,
#[serde(rename = "dataWarehouseId", skip_serializing_if = "Option::is_none")]
pub data_warehouse_id: Option<String>,
/// When true, the service cannot be deleted: the delete endpoint returns
/// 409 until deletion protection is turned off.
#[serde(rename = "deletionProtection", skip_serializing_if = "Option::is_none")]
pub deletion_protection: Option<bool>,
#[serde(rename = "enableCoreDumps", skip_serializing_if = "Option::is_none")]
pub enable_core_dumps: Option<bool>,
#[serde(
Expand Down Expand Up @@ -1785,6 +1789,13 @@ pub struct ServicePasswordPatchResponse {
/// `ServicePatchRequest` from the ClickHouse Cloud API.
#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
pub struct ServicePatchRequest {
/// When true, the service cannot be deleted: the delete endpoint returns
/// 409 until deletion protection is turned off. Changing it in either
/// direction requires `control-plane:service:delete` on the service, in
/// addition to `control-plane:service:manage`; sending the current value
/// changes nothing. ClickStack services cannot be updated through the API.
#[serde(rename = "deletionProtection", skip_serializing_if = "Option::is_none")]
pub deletion_protection: Option<bool>,
#[serde(rename = "enableCoreDumps", skip_serializing_if = "Option::is_none")]
pub enable_core_dumps: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -1834,6 +1845,13 @@ pub struct ServicePostRequest {
pub compliance_type: Option<ServicePostRequestCompliancetype>,
#[serde(rename = "dataWarehouseId", skip_serializing_if = "Option::is_none")]
pub data_warehouse_id: Option<String>,
/// When true, the service cannot be deleted: the delete endpoint returns
/// 409 until deletion protection is turned off. Defaults to false. Setting
/// it to true requires `control-plane:service:delete` granted for all
/// services in the organization, in addition to
/// `control-plane:organization:create-service`.
#[serde(rename = "deletionProtection", skip_serializing_if = "Option::is_none")]
pub deletion_protection: Option<bool>,
#[serde(rename = "enableCoreDumps", skip_serializing_if = "Option::is_none")]
pub enable_core_dumps: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down Expand Up @@ -1905,6 +1923,7 @@ impl ServicePostRequest {
byoc_id: None,
compliance_type: None,
data_warehouse_id: None,
deletion_protection: None,
enable_core_dumps: None,
endpoints: None,
has_transparent_data_encryption: None,
Expand Down Expand Up @@ -2045,6 +2064,10 @@ pub struct ServiceScalingPatchResponse {
pub current_scaling: Option<CurrentScaling>,
#[serde(rename = "dataWarehouseId", skip_serializing_if = "Option::is_none")]
pub data_warehouse_id: Option<String>,
/// When true, the service cannot be deleted: the delete endpoint returns
/// 409 until deletion protection is turned off.
#[serde(rename = "deletionProtection", skip_serializing_if = "Option::is_none")]
pub deletion_protection: Option<bool>,
#[serde(rename = "enableCoreDumps", skip_serializing_if = "Option::is_none")]
pub enable_core_dumps: Option<bool>,
#[serde(
Expand Down
2 changes: 2 additions & 0 deletions crates/clickhouse-cloud-api/tests/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ async fn api_error_403_forbidden() {
byoc_id: None,
compliance_type: None,
data_warehouse_id: None,
deletion_protection: None,
enable_core_dumps: None,
endpoints: None,
has_transparent_data_encryption: None,
Expand Down Expand Up @@ -390,6 +391,7 @@ async fn api_error_422_validation() {
byoc_id: None,
compliance_type: None,
data_warehouse_id: None,
deletion_protection: None,
enable_core_dumps: None,
endpoints: None,
has_transparent_data_encryption: None,
Expand Down
Loading
Loading