/*
* Artifact Keeper API
*
* Enterprise artifact registry supporting 45+ package formats.
*
* The version of the OpenAPI document: 1.2.1
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// UpsertScanConfigRequest : Request to create or update a scan configuration. Every field is optional so a `PUT /repositories/{key}/security` can carry any subset of mutable columns; fields the client omits keep their existing value (or fall back to the documented default when the row does not exist yet). The previous shape required all of `scan_enabled`, `scan_on_upload`, `scan_on_proxy`, `block_on_policy_violation`, `severity_threshold` on every call. That was the #1374 bug class on a second entity: a partial PUT (for example just `{scan_enabled: true}`) either bounced as a 422 or, worse, silently reset every other column to its default so a follow-up GET showed the untouched fields stale. The upsert is now a read-modify-write that merges the patch over the existing row, so multiple fields persist together and an omitted field is never clobbered. See #1374 / B11.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpsertScanConfigRequest {
#[serde(rename = "block_on_policy_violation", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub block_on_policy_violation: Option<Option<bool>>,
#[serde(rename = "scan_enabled", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub scan_enabled: Option<Option<bool>>,
#[serde(rename = "scan_on_proxy", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub scan_on_proxy: Option<Option<bool>>,
#[serde(rename = "scan_on_upload", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub scan_on_upload: Option<Option<bool>>,
#[serde(rename = "severity_threshold", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub severity_threshold: Option<Option<String>>,
}
impl UpsertScanConfigRequest {
/// Request to create or update a scan configuration. Every field is optional so a `PUT /repositories/{key}/security` can carry any subset of mutable columns; fields the client omits keep their existing value (or fall back to the documented default when the row does not exist yet). The previous shape required all of `scan_enabled`, `scan_on_upload`, `scan_on_proxy`, `block_on_policy_violation`, `severity_threshold` on every call. That was the #1374 bug class on a second entity: a partial PUT (for example just `{scan_enabled: true}`) either bounced as a 422 or, worse, silently reset every other column to its default so a follow-up GET showed the untouched fields stale. The upsert is now a read-modify-write that merges the patch over the existing row, so multiple fields persist together and an omitted field is never clobbered. See #1374 / B11.
pub fn new() -> UpsertScanConfigRequest {
UpsertScanConfigRequest {
block_on_policy_violation: None,
scan_enabled: None,
scan_on_proxy: None,
scan_on_upload: None,
severity_threshold: None,
}
}
}