Repository: bottlerocket-os/bottlerocket
File: sources/api/ecs-settings-applier/src/ecs.rs (Rust)

Code before:
    #[serde(rename = "GPUSupportEnabled")]
    gpu_support_enabled: bool,

    #[serde(
        rename = "TaskMetadataSteadyStateRate",
        skip_serializing_if = "Option::is_none"
    )]
    metadata_service_rps: Option<i64>,

    #[serde(
        rename = "TaskMetadataBurstRate",
        skip_serializing_if = "Option::is_none"
    )]
    metadata_service_burst: Option<i64>,

    #[serde(rename = "ReservedMemory", skip_serializing_if = "Option::is_none")]
    reserved_memory: Option<u16>,

    #[serde(
        rename = "NumImagesToDeletePerCycle",
        skip_serializing_if = "Option::is_none"
    )]
    image_cleanup_delete_per_cycle: Option<i64>,

    image_cleanup_disabled: bool,
}

// Returning a Result from main makes it print a Debug representation of the error, but with Snafu
// we have nice Display representations of the error, so we wrap "main" (run) and print any error.
// https://github.com/shepmaster/snafu/issues/110
pub(crate) async fn main() {
    if let Err(e) = run().await {
        eprintln!("{}", e);
        process::exit(1);
    }
}

async fn run() -> Result<()> {
    let args = parse_args(env::args());
    SimpleLogger::init(LevelFilter::Info, LogConfig::default()).context(error::LoggerSnafu)?;

    // Get all ecs and autoscaling settings values for config file templates
    debug!("Requesting ecs and autoscaling settings values");
    let settings = schnauzer::get_settings(&args.socket_path)
        .await
        .context(error::SettingsSnafu)?;

    debug!("settings = {:#?}", settings.settings);
    let ecs = settings
        .settings
        .as_ref()

Review comment (suggestion):
It seems like ECS Agent had enough changes to possibly be worth splitting off into a separate review. They are here now but it could help make review easier when there is already a lot to review to take the more involved ones and separate them.

Code after:
    #[serde(rename = "GPUSupportEnabled")]
    gpu_support_enabled: bool,

    #[serde(
        rename = "TaskMetadataSteadyStateRate",
        skip_serializing_if = "Option::is_none"
    )]
    metadata_service_rps: Option<i64>,

    #[serde(
        rename = "TaskMetadataBurstRate",
        skip_serializing_if = "Option::is_none"
    )]
    metadata_service_burst: Option<i64>,

    #[serde(rename = "ReservedMemory", skip_serializing_if = "Option::is_none")]
    reserved_memory: Option<u16>,

    #[serde(
        rename = "NumImagesToDeletePerCycle",
        skip_serializing_if = "Option::is_none"
    )]
    image_cleanup_delete_per_cycle: Option<i64>,

    image_cleanup_disabled: bool,

    #[serde(rename = "CNIPluginsPath")]
    cni_plugins_path: String,

    credentials_audit_log_file: String,

    data_dir: String,
}

// Returning a Result from main makes it print a Debug representation of the error, but with Snafu
// we have nice Display representations of the error, so we wrap "main" (run) and print any error.
// https://github.com/shepmaster/snafu/issues/110
pub(crate) async fn main() {
    if let Err(e) = run().await {
        eprintln!("{}", e);
        process::exit(1);
    }
}

async fn run() -> Result<()> {
    let args = parse_args(env::args());
    SimpleLogger::init(LevelFilter::Info, LogConfig::default()).context(error::LoggerSnafu)?;

    // Get all ecs and autoscaling settings values for config file templates
    debug!("Requesting ecs and autoscaling settings values");
    let settings = schnauzer::get_settings(&args.socket_path)