Skip to content
Closed
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
6 changes: 6 additions & 0 deletions crates/clickhouse-cloud-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ The spec no longer accepts `sandboxVersion` when creating a UDF or a UDF version

`ReversePrivateEndpoint` adds read-only `dns_targets` (`ReversePrivateEndpointDnsTarget`: `id`, `kind`, `internal_dns_name`) and `private_dns_mappings` (`ReversePrivateEndpointPrivateDnsMapping`: `private_dns_name`, `internal_dns_name`). `CustomPrivateDnsMapping` and `CustomPrivateDnsMappingResponse` gain optional `target_id`, which routes a VPC_RESOURCE custom DNS name to one of the endpoint's `dns_targets`; leave it `None` to keep the default target. Struct-literal callers supply the new fields as `None` or use `..Default::default()`.

The GCP `PgSize` values now carry local-SSD names, matching the spec: `c4-`, `c4a-` and `c4d-` sizes add `-lssd` (`c4-highmem-16` becomes `c4-highmem-lssd-16`, variant `C4_highmem_lssd_16`), and Z3 sizes add `-highmem` (`z3-highlssd-8` becomes `z3-highmem-highlssd-8`, variant `Z3_highmem_highlssd_8`). This is a breaking change for Rust callers: rename the variant. A response carrying a retired name deserializes to `PgSize::Unknown` rather than failing.

`PgConfig` and `PgConfigResponse` gain background-writer (`bgwriter_delay`, `bgwriter_flush_after`, `bgwriter_lru_maxpages`, `bgwriter_lru_multiplier`), I/O (`io_method`, `io_workers`, `maintenance_io_concurrency`), memory (`hash_mem_multiplier`, `logical_decoding_work_mem`, `temp_buffers`), logging (`log_lock_waits`, `log_min_duration_statement`, `log_parameter_max_length`, `log_temp_files`), replication (`max_logical_replication_workers`, `max_replication_slots`, `max_sync_workers_per_subscription`, `max_wal_senders`) and other settings (`default_toast_compression`, `enable_parallel_hash`, `track_activity_query_size`, `vacuum_cost_delay`). The four closed string settings use `PgConfigDefaultToastCompression`, `PgConfigEnableParallelHash`, `PgConfigIoMethod` and `PgConfigLogLockWaits`, each with a `VALUES` const. They join the existing partial-schema optionality exemptions and the `From` write-back. Struct-literal callers need the new fields as `None` or `..Default::default()`.

Postgres services gain an IPv4 access list. `PostgresService.ip_access_list` returns the current rules as `PostgresIpAccessListEntryResponse` (`id`, `source`, `port_range`, `description`); IPv6 rules are not included. `PostgresServicePostRequest.ip_access_list` sets the rules at creation: `None` allows every IPv4 and IPv6 address on 5432 and 6432, `Some(vec![])` blocks public access, and a list allows only those rules, so include one rule per required port. `PostgresServicePatchRequest.ip_access_list` takes `PostgresIpAccessListPatch`, which removes rules by ID (`PostgresIpAccessListRuleReference`) and then adds new rules or edits existing ones (include the returned `id`). Updates can partially succeed, so read the current list before retrying. `TryFrom<PostgresIpAccessListEntryResponse>` turns a fetched rule into an edit. Struct-literal callers of the Postgres create and patch requests need `ip_access_list: None` or `..Default::default()`.

### ClickHouse settings models

`ServiceClickhouseSettingsPatchRequest` uses a map of setting names to JSON values, and `ServiceClickhouseSettingsPatchResponse.settings` returns the applied map. The published OpenAPI now describes both fields as nonempty objects with string or integer values. Use `ServiceClickhouseSettingsPatchRequest<ServiceClickhouseSettingsMap>` and `ServiceClickhouseSettingValue` for typed requests; the default JSON-value map remains source-compatible with existing callers. Explicit `ServiceClickhouseSettingsPatchRequest<String>` callers remain supported: encoded objects are validated and serialized as objects before sending.
Expand Down
4,672 changes: 3,079 additions & 1,593 deletions crates/clickhouse-cloud-api/clickhouse_cloud_openapi.json

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions crates/clickhouse-cloud-api/src/convert/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,49 @@ impl From<PgConfigResponse> for PgConfig {
autovacuum_vacuum_scale_factor: value.autovacuum_vacuum_scale_factor,
autovacuum_vacuum_threshold: value.autovacuum_vacuum_threshold,
autovacuum_work_mem: value.autovacuum_work_mem,
bgwriter_delay: value.bgwriter_delay,
bgwriter_flush_after: value.bgwriter_flush_after,
bgwriter_lru_maxpages: value.bgwriter_lru_maxpages,
bgwriter_lru_multiplier: value.bgwriter_lru_multiplier,
checkpoint_timeout: value.checkpoint_timeout,
default_toast_compression: value.default_toast_compression,
default_transaction_isolation: value.default_transaction_isolation,
effective_cache_size: value.effective_cache_size,
effective_io_concurrency: value.effective_io_concurrency,
enable_parallel_hash: value.enable_parallel_hash,
hash_mem_multiplier: value.hash_mem_multiplier,
idle_in_transaction_session_timeout: value.idle_in_transaction_session_timeout,
idle_session_timeout: value.idle_session_timeout,
io_method: value.io_method,
io_workers: value.io_workers,
lock_timeout: value.lock_timeout,
log_lock_waits: value.log_lock_waits,
log_min_duration_statement: value.log_min_duration_statement,
log_parameter_max_length: value.log_parameter_max_length,
log_temp_files: value.log_temp_files,
logical_decoding_work_mem: value.logical_decoding_work_mem,
maintenance_io_concurrency: value.maintenance_io_concurrency,
maintenance_work_mem: value.maintenance_work_mem,
max_connections: value.max_connections,
max_logical_replication_workers: value.max_logical_replication_workers,
max_parallel_maintenance_workers: value.max_parallel_maintenance_workers,
max_parallel_workers: value.max_parallel_workers,
max_parallel_workers_per_gather: value.max_parallel_workers_per_gather,
max_replication_slots: value.max_replication_slots,
max_slot_wal_keep_size: value.max_slot_wal_keep_size,
max_sync_workers_per_subscription: value.max_sync_workers_per_subscription,
max_wal_senders: value.max_wal_senders,
max_wal_size: value.max_wal_size,
max_worker_processes: value.max_worker_processes,
min_wal_size: value.min_wal_size,
random_page_cost: value.random_page_cost,
shared_memory_percent: value.shared_memory_percent,
ssl_min_protocol_version: value.ssl_min_protocol_version,
statement_timeout: value.statement_timeout,
temp_buffers: value.temp_buffers,
track_activity_query_size: value.track_activity_query_size,
transaction_timeout: value.transaction_timeout,
vacuum_cost_delay: value.vacuum_cost_delay,
wal_buffers: value.wal_buffers,
wal_compression: value.wal_compression,
wal_keep_size: value.wal_keep_size,
Expand Down Expand Up @@ -73,3 +95,28 @@ impl TryFrom<PostgresInstanceConfigResponse> for PostgresInstanceConfig {
}
}
}

impl TryFrom<PostgresIpAccessListEntryResponse> for PostgresIpAccessListEntry {
type Error = MissingRequiredFields;

/// Turns a fetched rule into an `ipAccessList.add` entry that edits it in
/// place. `source` and `portRange` are required on write.
fn try_from(value: PostgresIpAccessListEntryResponse) -> Result<Self, Self::Error> {
let mut missing = Vec::new();
if value.port_range.is_none() {
missing.push("portRange");
}
if value.source.is_none() {
missing.push("source");
}
match (value.port_range, value.source) {
(Some(port_range), Some(source)) => Ok(Self {
description: value.description,
id: value.id,
port_range,
source,
}),
_ => Err(MissingRequiredFields::new(missing)),
}
}
}
10 changes: 10 additions & 0 deletions crates/clickhouse-cloud-api/src/meta/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,15 @@ pub const CLICK_STACK_VALIDATE_DASHBOARD: OperationMetadata = OperationMetadata
required_permissions: &["control-plane:service:manage-clickstack-api"],
};

/// `POST /v1/organizations/{organizationId}/services/{serviceId}/clickstack/webhooks/validate` (`clickStackValidateWebhook`).
pub const CLICK_STACK_VALIDATE_WEBHOOK: OperationMetadata = OperationMetadata {
operation_id: "clickStackValidateWebhook",
rust_method: "click_stack_validate_webhook",
method: "POST",
path: "/v1/organizations/{organizationId}/services/{serviceId}/clickstack/webhooks/validate",
required_permissions: &["control-plane:service:manage-clickstack-api"],
};

/// `GET /v1/organizations/{organizationId}/creditBalances` (`creditBalancesGet`).
pub const CREDIT_BALANCES_GET: OperationMetadata = OperationMetadata {
operation_id: "creditBalancesGet",
Expand Down Expand Up @@ -1631,6 +1640,7 @@ pub const ALL: &[OperationMetadata] = &[
CLICK_STACK_UPDATE_SOURCE,
CLICK_STACK_UPDATE_WEBHOOK,
CLICK_STACK_VALIDATE_DASHBOARD,
CLICK_STACK_VALIDATE_WEBHOOK,
CREDIT_BALANCES_GET,
INSTANCE_CREATE,
INSTANCE_DELETE,
Expand Down
28 changes: 16 additions & 12 deletions crates/clickhouse-cloud-api/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,18 +199,22 @@ pub use organizations::{
};
pub use postgres::{
BasePostgresService, PgBouncerConfig, PgBouncerConfigResponse, PgConfig,
PgConfigDefaultTransactionIsolation, PgConfigResponse, PgConfigSslMinProtocolVersion,
PgConfigWalCompression, PgCreatedAtProperty, PgHaType, PgIdProperty, PgIsPrimaryProperty,
PgNameProperty, PgPassword, PgPitrRestoreTargetProperty, PgProvider, PgRegion, PgSize,
PgStateProperty, PgStorageSize, PgTags, PgTagsResponse, PgVersion, PostgresBackup,
PostgresInstanceConfig, PostgresInstanceConfigResponse, PostgresInstanceUpdateConfigResponse,
PostgresLogEntry, PostgresLogsGetListSortorder, PostgresMetric, PostgresMetricDataPoint,
PostgresMetricSeries, PostgresMetrics, PostgresQueryExecution, PostgresService,
PostgresServiceListItem, PostgresServicePasswordResource, PostgresServicePatchRequest,
PostgresServicePostRequest, PostgresServiceReadReplicaRequest, PostgresServiceRestoreRequest,
PostgresServiceSetPassword, PostgresServiceSetState, PostgresServiceSetStateCommand,
PostgresSlowQueryPattern, PostgresSlowQueryPatternDetail, RunPostgresQueryRequest,
SlowQueryPatternsGetListSortby, SlowQueryPatternsGetListSortorder,
PgConfigDefaultToastCompression, PgConfigDefaultTransactionIsolation,
PgConfigEnableParallelHash, PgConfigIoMethod, PgConfigLogLockWaits, PgConfigResponse,
PgConfigSslMinProtocolVersion, PgConfigWalCompression, PgCreatedAtProperty, PgHaType,
PgIdProperty, PgIsPrimaryProperty, PgNameProperty, PgPassword, PgPitrRestoreTargetProperty,
PgProvider, PgRegion, PgSize, PgStateProperty, PgStorageSize, PgTags, PgTagsResponse,
PgVersion, PostgresBackup, PostgresInstanceConfig, PostgresInstanceConfigResponse,
PostgresInstanceUpdateConfigResponse, PostgresIpAccessListEntry,
PostgresIpAccessListEntryResponse, PostgresIpAccessListPatch,
PostgresIpAccessListRuleReference, PostgresLogEntry, PostgresLogsGetListSortorder,
PostgresMetric, PostgresMetricDataPoint, PostgresMetricSeries, PostgresMetrics,
PostgresQueryExecution, PostgresService, PostgresServiceListItem,
PostgresServicePasswordResource, PostgresServicePatchRequest, PostgresServicePostRequest,
PostgresServiceReadReplicaRequest, PostgresServiceRestoreRequest, PostgresServiceSetPassword,
PostgresServiceSetState, PostgresServiceSetStateCommand, PostgresSlowQueryPattern,
PostgresSlowQueryPatternDetail, RunPostgresQueryRequest, SlowQueryPatternsGetListSortby,
SlowQueryPatternsGetListSortorder,
};
pub use query_api_endpoints::{
PublicQueryApiEndpoint, PublicQueryApiEndpointListItem,
Expand Down
Loading
Loading