// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_structure_associate_node_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::AssociateNodeInput,
) {
    if let Some(var_1) = &input.server_name {
        object.key("ServerName").string(var_1);
    }
    if let Some(var_2) = &input.node_name {
        object.key("NodeName").string(var_2);
    }
    if let Some(var_3) = &input.engine_attributes {
        let mut array_4 = object.key("EngineAttributes").start_array();
        for item_5 in var_3 {
            {
                let mut object_6 = array_4.value().start_object();
                crate::json_ser::serialize_structure_engine_attribute(&mut object_6, item_5);
                object_6.finish();
            }
        }
        array_4.finish();
    }
}

pub fn serialize_structure_create_backup_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateBackupInput,
) {
    if let Some(var_7) = &input.server_name {
        object.key("ServerName").string(var_7);
    }
    if let Some(var_8) = &input.description {
        object.key("Description").string(var_8);
    }
    if let Some(var_9) = &input.tags {
        let mut array_10 = object.key("Tags").start_array();
        for item_11 in var_9 {
            {
                let mut object_12 = array_10.value().start_object();
                crate::json_ser::serialize_structure_tag(&mut object_12, item_11);
                object_12.finish();
            }
        }
        array_10.finish();
    }
}

pub fn serialize_structure_create_server_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateServerInput,
) {
    if let Some(var_13) = &input.associate_public_ip_address {
        object.key("AssociatePublicIpAddress").boolean(*var_13);
    }
    if let Some(var_14) = &input.custom_domain {
        object.key("CustomDomain").string(var_14);
    }
    if let Some(var_15) = &input.custom_certificate {
        object.key("CustomCertificate").string(var_15);
    }
    if let Some(var_16) = &input.custom_private_key {
        object.key("CustomPrivateKey").string(var_16);
    }
    if let Some(var_17) = &input.disable_automated_backup {
        object.key("DisableAutomatedBackup").boolean(*var_17);
    }
    if let Some(var_18) = &input.engine {
        object.key("Engine").string(var_18);
    }
    if let Some(var_19) = &input.engine_model {
        object.key("EngineModel").string(var_19);
    }
    if let Some(var_20) = &input.engine_version {
        object.key("EngineVersion").string(var_20);
    }
    if let Some(var_21) = &input.engine_attributes {
        let mut array_22 = object.key("EngineAttributes").start_array();
        for item_23 in var_21 {
            {
                let mut object_24 = array_22.value().start_object();
                crate::json_ser::serialize_structure_engine_attribute(&mut object_24, item_23);
                object_24.finish();
            }
        }
        array_22.finish();
    }
    if let Some(var_25) = &input.backup_retention_count {
        object.key("BackupRetentionCount").number(
            #[allow(clippy::useless_conversion)]
            smithy_types::Number::NegInt((*var_25).into()),
        );
    }
    if let Some(var_26) = &input.server_name {
        object.key("ServerName").string(var_26);
    }
    if let Some(var_27) = &input.instance_profile_arn {
        object.key("InstanceProfileArn").string(var_27);
    }
    if let Some(var_28) = &input.instance_type {
        object.key("InstanceType").string(var_28);
    }
    if let Some(var_29) = &input.key_pair {
        object.key("KeyPair").string(var_29);
    }
    if let Some(var_30) = &input.preferred_maintenance_window {
        object.key("PreferredMaintenanceWindow").string(var_30);
    }
    if let Some(var_31) = &input.preferred_backup_window {
        object.key("PreferredBackupWindow").string(var_31);
    }
    if let Some(var_32) = &input.security_group_ids {
        let mut array_33 = object.key("SecurityGroupIds").start_array();
        for item_34 in var_32 {
            {
                array_33.value().string(item_34);
            }
        }
        array_33.finish();
    }
    if let Some(var_35) = &input.service_role_arn {
        object.key("ServiceRoleArn").string(var_35);
    }
    if let Some(var_36) = &input.subnet_ids {
        let mut array_37 = object.key("SubnetIds").start_array();
        for item_38 in var_36 {
            {
                array_37.value().string(item_38);
            }
        }
        array_37.finish();
    }
    if let Some(var_39) = &input.tags {
        let mut array_40 = object.key("Tags").start_array();
        for item_41 in var_39 {
            {
                let mut object_42 = array_40.value().start_object();
                crate::json_ser::serialize_structure_tag(&mut object_42, item_41);
                object_42.finish();
            }
        }
        array_40.finish();
    }
    if let Some(var_43) = &input.backup_id {
        object.key("BackupId").string(var_43);
    }
}

pub fn serialize_structure_delete_backup_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteBackupInput,
) {
    if let Some(var_44) = &input.backup_id {
        object.key("BackupId").string(var_44);
    }
}

pub fn serialize_structure_delete_server_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteServerInput,
) {
    if let Some(var_45) = &input.server_name {
        object.key("ServerName").string(var_45);
    }
}

pub fn serialize_structure_describe_backups_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DescribeBackupsInput,
) {
    if let Some(var_46) = &input.backup_id {
        object.key("BackupId").string(var_46);
    }
    if let Some(var_47) = &input.server_name {
        object.key("ServerName").string(var_47);
    }
    if let Some(var_48) = &input.next_token {
        object.key("NextToken").string(var_48);
    }
    if let Some(var_49) = &input.max_results {
        object.key("MaxResults").number(
            #[allow(clippy::useless_conversion)]
            smithy_types::Number::NegInt((*var_49).into()),
        );
    }
}

pub fn serialize_structure_describe_events_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DescribeEventsInput,
) {
    if let Some(var_50) = &input.server_name {
        object.key("ServerName").string(var_50);
    }
    if let Some(var_51) = &input.next_token {
        object.key("NextToken").string(var_51);
    }
    if let Some(var_52) = &input.max_results {
        object.key("MaxResults").number(
            #[allow(clippy::useless_conversion)]
            smithy_types::Number::NegInt((*var_52).into()),
        );
    }
}

pub fn serialize_structure_describe_node_association_status_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DescribeNodeAssociationStatusInput,
) {
    if let Some(var_53) = &input.node_association_status_token {
        object.key("NodeAssociationStatusToken").string(var_53);
    }
    if let Some(var_54) = &input.server_name {
        object.key("ServerName").string(var_54);
    }
}

pub fn serialize_structure_describe_servers_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DescribeServersInput,
) {
    if let Some(var_55) = &input.server_name {
        object.key("ServerName").string(var_55);
    }
    if let Some(var_56) = &input.next_token {
        object.key("NextToken").string(var_56);
    }
    if let Some(var_57) = &input.max_results {
        object.key("MaxResults").number(
            #[allow(clippy::useless_conversion)]
            smithy_types::Number::NegInt((*var_57).into()),
        );
    }
}

pub fn serialize_structure_disassociate_node_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DisassociateNodeInput,
) {
    if let Some(var_58) = &input.server_name {
        object.key("ServerName").string(var_58);
    }
    if let Some(var_59) = &input.node_name {
        object.key("NodeName").string(var_59);
    }
    if let Some(var_60) = &input.engine_attributes {
        let mut array_61 = object.key("EngineAttributes").start_array();
        for item_62 in var_60 {
            {
                let mut object_63 = array_61.value().start_object();
                crate::json_ser::serialize_structure_engine_attribute(&mut object_63, item_62);
                object_63.finish();
            }
        }
        array_61.finish();
    }
}

pub fn serialize_structure_export_server_engine_attribute_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ExportServerEngineAttributeInput,
) {
    if let Some(var_64) = &input.export_attribute_name {
        object.key("ExportAttributeName").string(var_64);
    }
    if let Some(var_65) = &input.server_name {
        object.key("ServerName").string(var_65);
    }
    if let Some(var_66) = &input.input_attributes {
        let mut array_67 = object.key("InputAttributes").start_array();
        for item_68 in var_66 {
            {
                let mut object_69 = array_67.value().start_object();
                crate::json_ser::serialize_structure_engine_attribute(&mut object_69, item_68);
                object_69.finish();
            }
        }
        array_67.finish();
    }
}

pub fn serialize_structure_list_tags_for_resource_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListTagsForResourceInput,
) {
    if let Some(var_70) = &input.resource_arn {
        object.key("ResourceArn").string(var_70);
    }
    if let Some(var_71) = &input.next_token {
        object.key("NextToken").string(var_71);
    }
    if let Some(var_72) = &input.max_results {
        object.key("MaxResults").number(
            #[allow(clippy::useless_conversion)]
            smithy_types::Number::NegInt((*var_72).into()),
        );
    }
}

pub fn serialize_structure_restore_server_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::RestoreServerInput,
) {
    if let Some(var_73) = &input.backup_id {
        object.key("BackupId").string(var_73);
    }
    if let Some(var_74) = &input.server_name {
        object.key("ServerName").string(var_74);
    }
    if let Some(var_75) = &input.instance_type {
        object.key("InstanceType").string(var_75);
    }
    if let Some(var_76) = &input.key_pair {
        object.key("KeyPair").string(var_76);
    }
}

pub fn serialize_structure_start_maintenance_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::StartMaintenanceInput,
) {
    if let Some(var_77) = &input.server_name {
        object.key("ServerName").string(var_77);
    }
    if let Some(var_78) = &input.engine_attributes {
        let mut array_79 = object.key("EngineAttributes").start_array();
        for item_80 in var_78 {
            {
                let mut object_81 = array_79.value().start_object();
                crate::json_ser::serialize_structure_engine_attribute(&mut object_81, item_80);
                object_81.finish();
            }
        }
        array_79.finish();
    }
}

pub fn serialize_structure_tag_resource_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::TagResourceInput,
) {
    if let Some(var_82) = &input.resource_arn {
        object.key("ResourceArn").string(var_82);
    }
    if let Some(var_83) = &input.tags {
        let mut array_84 = object.key("Tags").start_array();
        for item_85 in var_83 {
            {
                let mut object_86 = array_84.value().start_object();
                crate::json_ser::serialize_structure_tag(&mut object_86, item_85);
                object_86.finish();
            }
        }
        array_84.finish();
    }
}

pub fn serialize_structure_untag_resource_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UntagResourceInput,
) {
    if let Some(var_87) = &input.resource_arn {
        object.key("ResourceArn").string(var_87);
    }
    if let Some(var_88) = &input.tag_keys {
        let mut array_89 = object.key("TagKeys").start_array();
        for item_90 in var_88 {
            {
                array_89.value().string(item_90);
            }
        }
        array_89.finish();
    }
}

pub fn serialize_structure_update_server_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateServerInput,
) {
    if let Some(var_91) = &input.disable_automated_backup {
        object.key("DisableAutomatedBackup").boolean(*var_91);
    }
    if let Some(var_92) = &input.backup_retention_count {
        object.key("BackupRetentionCount").number(
            #[allow(clippy::useless_conversion)]
            smithy_types::Number::NegInt((*var_92).into()),
        );
    }
    if let Some(var_93) = &input.server_name {
        object.key("ServerName").string(var_93);
    }
    if let Some(var_94) = &input.preferred_maintenance_window {
        object.key("PreferredMaintenanceWindow").string(var_94);
    }
    if let Some(var_95) = &input.preferred_backup_window {
        object.key("PreferredBackupWindow").string(var_95);
    }
}

pub fn serialize_structure_update_server_engine_attributes_input(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateServerEngineAttributesInput,
) {
    if let Some(var_96) = &input.server_name {
        object.key("ServerName").string(var_96);
    }
    if let Some(var_97) = &input.attribute_name {
        object.key("AttributeName").string(var_97);
    }
    if let Some(var_98) = &input.attribute_value {
        object.key("AttributeValue").string(var_98);
    }
}

pub fn serialize_structure_engine_attribute(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::EngineAttribute,
) {
    if let Some(var_99) = &input.name {
        object.key("Name").string(var_99);
    }
    if let Some(var_100) = &input.value {
        object.key("Value").string(var_100);
    }
}

pub fn serialize_structure_tag(
    object: &mut smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Tag,
) {
    if let Some(var_101) = &input.key {
        object.key("Key").string(var_101);
    }
    if let Some(var_102) = &input.value {
        object.key("Value").string(var_102);
    }
}
