// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn serialize_structure_crate_input_associate_web_acl_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::AssociateWebAclInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_1) = &input.web_acl_id {
        object.key("WebACLId").string(var_1);
    }
    if let Some(var_2) = &input.resource_arn {
        object.key("ResourceArn").string(var_2);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_byte_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateByteMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_3) = &input.name {
        object.key("Name").string(var_3);
    }
    if let Some(var_4) = &input.change_token {
        object.key("ChangeToken").string(var_4);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_geo_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateGeoMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_5) = &input.name {
        object.key("Name").string(var_5);
    }
    if let Some(var_6) = &input.change_token {
        object.key("ChangeToken").string(var_6);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_ip_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateIpSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_7) = &input.name {
        object.key("Name").string(var_7);
    }
    if let Some(var_8) = &input.change_token {
        object.key("ChangeToken").string(var_8);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_rate_based_rule_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateRateBasedRuleInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_9) = &input.name {
        object.key("Name").string(var_9);
    }
    if let Some(var_10) = &input.metric_name {
        object.key("MetricName").string(var_10);
    }
    if let Some(var_11) = &input.rate_key {
        object.key("RateKey").string(var_11.as_str());
    }
    {
        object.key("RateLimit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.rate_limit).into()),
        );
    }
    if let Some(var_12) = &input.change_token {
        object.key("ChangeToken").string(var_12);
    }
    if let Some(var_13) = &input.tags {
        let mut array_14 = object.key("Tags").start_array();
        for item_15 in var_13 {
            {
                let mut object_16 = array_14.value().start_object();
                crate::json_ser::serialize_structure_crate_model_tag(&mut object_16, item_15)?;
                object_16.finish();
            }
        }
        array_14.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_regex_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateRegexMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_17) = &input.name {
        object.key("Name").string(var_17);
    }
    if let Some(var_18) = &input.change_token {
        object.key("ChangeToken").string(var_18);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_regex_pattern_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateRegexPatternSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_19) = &input.name {
        object.key("Name").string(var_19);
    }
    if let Some(var_20) = &input.change_token {
        object.key("ChangeToken").string(var_20);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_rule_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateRuleInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_21) = &input.name {
        object.key("Name").string(var_21);
    }
    if let Some(var_22) = &input.metric_name {
        object.key("MetricName").string(var_22);
    }
    if let Some(var_23) = &input.change_token {
        object.key("ChangeToken").string(var_23);
    }
    if let Some(var_24) = &input.tags {
        let mut array_25 = object.key("Tags").start_array();
        for item_26 in var_24 {
            {
                let mut object_27 = array_25.value().start_object();
                crate::json_ser::serialize_structure_crate_model_tag(&mut object_27, item_26)?;
                object_27.finish();
            }
        }
        array_25.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_rule_group_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateRuleGroupInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_28) = &input.name {
        object.key("Name").string(var_28);
    }
    if let Some(var_29) = &input.metric_name {
        object.key("MetricName").string(var_29);
    }
    if let Some(var_30) = &input.change_token {
        object.key("ChangeToken").string(var_30);
    }
    if let Some(var_31) = &input.tags {
        let mut array_32 = object.key("Tags").start_array();
        for item_33 in var_31 {
            {
                let mut object_34 = array_32.value().start_object();
                crate::json_ser::serialize_structure_crate_model_tag(&mut object_34, item_33)?;
                object_34.finish();
            }
        }
        array_32.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_size_constraint_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateSizeConstraintSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_35) = &input.name {
        object.key("Name").string(var_35);
    }
    if let Some(var_36) = &input.change_token {
        object.key("ChangeToken").string(var_36);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_sql_injection_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateSqlInjectionMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_37) = &input.name {
        object.key("Name").string(var_37);
    }
    if let Some(var_38) = &input.change_token {
        object.key("ChangeToken").string(var_38);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_web_acl_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateWebAclInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_39) = &input.name {
        object.key("Name").string(var_39);
    }
    if let Some(var_40) = &input.metric_name {
        object.key("MetricName").string(var_40);
    }
    if let Some(var_41) = &input.default_action {
        let mut object_42 = object.key("DefaultAction").start_object();
        crate::json_ser::serialize_structure_crate_model_waf_action(&mut object_42, var_41)?;
        object_42.finish();
    }
    if let Some(var_43) = &input.change_token {
        object.key("ChangeToken").string(var_43);
    }
    if let Some(var_44) = &input.tags {
        let mut array_45 = object.key("Tags").start_array();
        for item_46 in var_44 {
            {
                let mut object_47 = array_45.value().start_object();
                crate::json_ser::serialize_structure_crate_model_tag(&mut object_47, item_46)?;
                object_47.finish();
            }
        }
        array_45.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_web_acl_migration_stack_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateWebAclMigrationStackInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_48) = &input.web_acl_id {
        object.key("WebACLId").string(var_48);
    }
    if let Some(var_49) = &input.s3_bucket_name {
        object.key("S3BucketName").string(var_49);
    }
    if let Some(var_50) = &input.ignore_unsupported_type {
        object.key("IgnoreUnsupportedType").boolean(*var_50);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_create_xss_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::CreateXssMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_51) = &input.name {
        object.key("Name").string(var_51);
    }
    if let Some(var_52) = &input.change_token {
        object.key("ChangeToken").string(var_52);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_byte_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteByteMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_53) = &input.byte_match_set_id {
        object.key("ByteMatchSetId").string(var_53);
    }
    if let Some(var_54) = &input.change_token {
        object.key("ChangeToken").string(var_54);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_geo_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteGeoMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_55) = &input.geo_match_set_id {
        object.key("GeoMatchSetId").string(var_55);
    }
    if let Some(var_56) = &input.change_token {
        object.key("ChangeToken").string(var_56);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_ip_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteIpSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_57) = &input.ip_set_id {
        object.key("IPSetId").string(var_57);
    }
    if let Some(var_58) = &input.change_token {
        object.key("ChangeToken").string(var_58);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_logging_configuration_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteLoggingConfigurationInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_59) = &input.resource_arn {
        object.key("ResourceArn").string(var_59);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_permission_policy_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeletePermissionPolicyInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_60) = &input.resource_arn {
        object.key("ResourceArn").string(var_60);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_rate_based_rule_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteRateBasedRuleInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_61) = &input.rule_id {
        object.key("RuleId").string(var_61);
    }
    if let Some(var_62) = &input.change_token {
        object.key("ChangeToken").string(var_62);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_regex_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteRegexMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_63) = &input.regex_match_set_id {
        object.key("RegexMatchSetId").string(var_63);
    }
    if let Some(var_64) = &input.change_token {
        object.key("ChangeToken").string(var_64);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_regex_pattern_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteRegexPatternSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_65) = &input.regex_pattern_set_id {
        object.key("RegexPatternSetId").string(var_65);
    }
    if let Some(var_66) = &input.change_token {
        object.key("ChangeToken").string(var_66);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_rule_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteRuleInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_67) = &input.rule_id {
        object.key("RuleId").string(var_67);
    }
    if let Some(var_68) = &input.change_token {
        object.key("ChangeToken").string(var_68);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_rule_group_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteRuleGroupInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_69) = &input.rule_group_id {
        object.key("RuleGroupId").string(var_69);
    }
    if let Some(var_70) = &input.change_token {
        object.key("ChangeToken").string(var_70);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_size_constraint_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteSizeConstraintSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_71) = &input.size_constraint_set_id {
        object.key("SizeConstraintSetId").string(var_71);
    }
    if let Some(var_72) = &input.change_token {
        object.key("ChangeToken").string(var_72);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_sql_injection_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteSqlInjectionMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_73) = &input.sql_injection_match_set_id {
        object.key("SqlInjectionMatchSetId").string(var_73);
    }
    if let Some(var_74) = &input.change_token {
        object.key("ChangeToken").string(var_74);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_web_acl_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteWebAclInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_75) = &input.web_acl_id {
        object.key("WebACLId").string(var_75);
    }
    if let Some(var_76) = &input.change_token {
        object.key("ChangeToken").string(var_76);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_delete_xss_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DeleteXssMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_77) = &input.xss_match_set_id {
        object.key("XssMatchSetId").string(var_77);
    }
    if let Some(var_78) = &input.change_token {
        object.key("ChangeToken").string(var_78);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_disassociate_web_acl_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::DisassociateWebAclInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_79) = &input.resource_arn {
        object.key("ResourceArn").string(var_79);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_byte_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetByteMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_80) = &input.byte_match_set_id {
        object.key("ByteMatchSetId").string(var_80);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_change_token_status_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetChangeTokenStatusInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_81) = &input.change_token {
        object.key("ChangeToken").string(var_81);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_geo_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetGeoMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_82) = &input.geo_match_set_id {
        object.key("GeoMatchSetId").string(var_82);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_ip_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetIpSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_83) = &input.ip_set_id {
        object.key("IPSetId").string(var_83);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_logging_configuration_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetLoggingConfigurationInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_84) = &input.resource_arn {
        object.key("ResourceArn").string(var_84);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_permission_policy_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetPermissionPolicyInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_85) = &input.resource_arn {
        object.key("ResourceArn").string(var_85);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_rate_based_rule_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetRateBasedRuleInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_86) = &input.rule_id {
        object.key("RuleId").string(var_86);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_rate_based_rule_managed_keys_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetRateBasedRuleManagedKeysInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_87) = &input.rule_id {
        object.key("RuleId").string(var_87);
    }
    if let Some(var_88) = &input.next_marker {
        object.key("NextMarker").string(var_88);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_regex_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetRegexMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_89) = &input.regex_match_set_id {
        object.key("RegexMatchSetId").string(var_89);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_regex_pattern_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetRegexPatternSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_90) = &input.regex_pattern_set_id {
        object.key("RegexPatternSetId").string(var_90);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_rule_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetRuleInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_91) = &input.rule_id {
        object.key("RuleId").string(var_91);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_rule_group_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetRuleGroupInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_92) = &input.rule_group_id {
        object.key("RuleGroupId").string(var_92);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_sampled_requests_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetSampledRequestsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_93) = &input.web_acl_id {
        object.key("WebAclId").string(var_93);
    }
    if let Some(var_94) = &input.rule_id {
        object.key("RuleId").string(var_94);
    }
    if let Some(var_95) = &input.time_window {
        let mut object_96 = object.key("TimeWindow").start_object();
        crate::json_ser::serialize_structure_crate_model_time_window(&mut object_96, var_95)?;
        object_96.finish();
    }
    {
        object.key("MaxItems").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.max_items).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_size_constraint_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetSizeConstraintSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_97) = &input.size_constraint_set_id {
        object.key("SizeConstraintSetId").string(var_97);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_sql_injection_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetSqlInjectionMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_98) = &input.sql_injection_match_set_id {
        object.key("SqlInjectionMatchSetId").string(var_98);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_web_acl_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetWebAclInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_99) = &input.web_acl_id {
        object.key("WebACLId").string(var_99);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_web_acl_for_resource_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetWebAclForResourceInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_100) = &input.resource_arn {
        object.key("ResourceArn").string(var_100);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_get_xss_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::GetXssMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_101) = &input.xss_match_set_id {
        object.key("XssMatchSetId").string(var_101);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_activated_rules_in_rule_group_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListActivatedRulesInRuleGroupInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_102) = &input.rule_group_id {
        object.key("RuleGroupId").string(var_102);
    }
    if let Some(var_103) = &input.next_marker {
        object.key("NextMarker").string(var_103);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_byte_match_sets_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListByteMatchSetsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_104) = &input.next_marker {
        object.key("NextMarker").string(var_104);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_geo_match_sets_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListGeoMatchSetsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_105) = &input.next_marker {
        object.key("NextMarker").string(var_105);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_ip_sets_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListIpSetsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_106) = &input.next_marker {
        object.key("NextMarker").string(var_106);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_logging_configurations_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListLoggingConfigurationsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_107) = &input.next_marker {
        object.key("NextMarker").string(var_107);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_rate_based_rules_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListRateBasedRulesInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_108) = &input.next_marker {
        object.key("NextMarker").string(var_108);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_regex_match_sets_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListRegexMatchSetsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_109) = &input.next_marker {
        object.key("NextMarker").string(var_109);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_regex_pattern_sets_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListRegexPatternSetsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_110) = &input.next_marker {
        object.key("NextMarker").string(var_110);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_resources_for_web_acl_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListResourcesForWebAclInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_111) = &input.web_acl_id {
        object.key("WebACLId").string(var_111);
    }
    if let Some(var_112) = &input.resource_type {
        object.key("ResourceType").string(var_112.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_rule_groups_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListRuleGroupsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_113) = &input.next_marker {
        object.key("NextMarker").string(var_113);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_rules_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListRulesInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_114) = &input.next_marker {
        object.key("NextMarker").string(var_114);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_size_constraint_sets_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListSizeConstraintSetsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_115) = &input.next_marker {
        object.key("NextMarker").string(var_115);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_sql_injection_match_sets_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListSqlInjectionMatchSetsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_116) = &input.next_marker {
        object.key("NextMarker").string(var_116);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_subscribed_rule_groups_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListSubscribedRuleGroupsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_117) = &input.next_marker {
        object.key("NextMarker").string(var_117);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_tags_for_resource_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListTagsForResourceInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_118) = &input.next_marker {
        object.key("NextMarker").string(var_118);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    if let Some(var_119) = &input.resource_arn {
        object.key("ResourceARN").string(var_119);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_web_ac_ls_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListWebAcLsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_120) = &input.next_marker {
        object.key("NextMarker").string(var_120);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_list_xss_match_sets_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::ListXssMatchSetsInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_121) = &input.next_marker {
        object.key("NextMarker").string(var_121);
    }
    if input.limit != 0 {
        object.key("Limit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_put_logging_configuration_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::PutLoggingConfigurationInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_122) = &input.logging_configuration {
        let mut object_123 = object.key("LoggingConfiguration").start_object();
        crate::json_ser::serialize_structure_crate_model_logging_configuration(
            &mut object_123,
            var_122,
        )?;
        object_123.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_put_permission_policy_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::PutPermissionPolicyInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_124) = &input.resource_arn {
        object.key("ResourceArn").string(var_124);
    }
    if let Some(var_125) = &input.policy {
        object.key("Policy").string(var_125);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_tag_resource_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::TagResourceInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_126) = &input.resource_arn {
        object.key("ResourceARN").string(var_126);
    }
    if let Some(var_127) = &input.tags {
        let mut array_128 = object.key("Tags").start_array();
        for item_129 in var_127 {
            {
                let mut object_130 = array_128.value().start_object();
                crate::json_ser::serialize_structure_crate_model_tag(&mut object_130, item_129)?;
                object_130.finish();
            }
        }
        array_128.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_untag_resource_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UntagResourceInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_131) = &input.resource_arn {
        object.key("ResourceARN").string(var_131);
    }
    if let Some(var_132) = &input.tag_keys {
        let mut array_133 = object.key("TagKeys").start_array();
        for item_134 in var_132 {
            {
                array_133.value().string(item_134);
            }
        }
        array_133.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_byte_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateByteMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_135) = &input.byte_match_set_id {
        object.key("ByteMatchSetId").string(var_135);
    }
    if let Some(var_136) = &input.change_token {
        object.key("ChangeToken").string(var_136);
    }
    if let Some(var_137) = &input.updates {
        let mut array_138 = object.key("Updates").start_array();
        for item_139 in var_137 {
            {
                let mut object_140 = array_138.value().start_object();
                crate::json_ser::serialize_structure_crate_model_byte_match_set_update(
                    &mut object_140,
                    item_139,
                )?;
                object_140.finish();
            }
        }
        array_138.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_geo_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateGeoMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_141) = &input.geo_match_set_id {
        object.key("GeoMatchSetId").string(var_141);
    }
    if let Some(var_142) = &input.change_token {
        object.key("ChangeToken").string(var_142);
    }
    if let Some(var_143) = &input.updates {
        let mut array_144 = object.key("Updates").start_array();
        for item_145 in var_143 {
            {
                let mut object_146 = array_144.value().start_object();
                crate::json_ser::serialize_structure_crate_model_geo_match_set_update(
                    &mut object_146,
                    item_145,
                )?;
                object_146.finish();
            }
        }
        array_144.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_ip_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateIpSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_147) = &input.ip_set_id {
        object.key("IPSetId").string(var_147);
    }
    if let Some(var_148) = &input.change_token {
        object.key("ChangeToken").string(var_148);
    }
    if let Some(var_149) = &input.updates {
        let mut array_150 = object.key("Updates").start_array();
        for item_151 in var_149 {
            {
                let mut object_152 = array_150.value().start_object();
                crate::json_ser::serialize_structure_crate_model_ip_set_update(
                    &mut object_152,
                    item_151,
                )?;
                object_152.finish();
            }
        }
        array_150.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_rate_based_rule_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateRateBasedRuleInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_153) = &input.rule_id {
        object.key("RuleId").string(var_153);
    }
    if let Some(var_154) = &input.change_token {
        object.key("ChangeToken").string(var_154);
    }
    if let Some(var_155) = &input.updates {
        let mut array_156 = object.key("Updates").start_array();
        for item_157 in var_155 {
            {
                let mut object_158 = array_156.value().start_object();
                crate::json_ser::serialize_structure_crate_model_rule_update(
                    &mut object_158,
                    item_157,
                )?;
                object_158.finish();
            }
        }
        array_156.finish();
    }
    {
        object.key("RateLimit").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.rate_limit).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_regex_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateRegexMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_159) = &input.regex_match_set_id {
        object.key("RegexMatchSetId").string(var_159);
    }
    if let Some(var_160) = &input.updates {
        let mut array_161 = object.key("Updates").start_array();
        for item_162 in var_160 {
            {
                let mut object_163 = array_161.value().start_object();
                crate::json_ser::serialize_structure_crate_model_regex_match_set_update(
                    &mut object_163,
                    item_162,
                )?;
                object_163.finish();
            }
        }
        array_161.finish();
    }
    if let Some(var_164) = &input.change_token {
        object.key("ChangeToken").string(var_164);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_regex_pattern_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateRegexPatternSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_165) = &input.regex_pattern_set_id {
        object.key("RegexPatternSetId").string(var_165);
    }
    if let Some(var_166) = &input.updates {
        let mut array_167 = object.key("Updates").start_array();
        for item_168 in var_166 {
            {
                let mut object_169 = array_167.value().start_object();
                crate::json_ser::serialize_structure_crate_model_regex_pattern_set_update(
                    &mut object_169,
                    item_168,
                )?;
                object_169.finish();
            }
        }
        array_167.finish();
    }
    if let Some(var_170) = &input.change_token {
        object.key("ChangeToken").string(var_170);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_rule_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateRuleInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_171) = &input.rule_id {
        object.key("RuleId").string(var_171);
    }
    if let Some(var_172) = &input.change_token {
        object.key("ChangeToken").string(var_172);
    }
    if let Some(var_173) = &input.updates {
        let mut array_174 = object.key("Updates").start_array();
        for item_175 in var_173 {
            {
                let mut object_176 = array_174.value().start_object();
                crate::json_ser::serialize_structure_crate_model_rule_update(
                    &mut object_176,
                    item_175,
                )?;
                object_176.finish();
            }
        }
        array_174.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_rule_group_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateRuleGroupInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_177) = &input.rule_group_id {
        object.key("RuleGroupId").string(var_177);
    }
    if let Some(var_178) = &input.updates {
        let mut array_179 = object.key("Updates").start_array();
        for item_180 in var_178 {
            {
                let mut object_181 = array_179.value().start_object();
                crate::json_ser::serialize_structure_crate_model_rule_group_update(
                    &mut object_181,
                    item_180,
                )?;
                object_181.finish();
            }
        }
        array_179.finish();
    }
    if let Some(var_182) = &input.change_token {
        object.key("ChangeToken").string(var_182);
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_size_constraint_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateSizeConstraintSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_183) = &input.size_constraint_set_id {
        object.key("SizeConstraintSetId").string(var_183);
    }
    if let Some(var_184) = &input.change_token {
        object.key("ChangeToken").string(var_184);
    }
    if let Some(var_185) = &input.updates {
        let mut array_186 = object.key("Updates").start_array();
        for item_187 in var_185 {
            {
                let mut object_188 = array_186.value().start_object();
                crate::json_ser::serialize_structure_crate_model_size_constraint_set_update(
                    &mut object_188,
                    item_187,
                )?;
                object_188.finish();
            }
        }
        array_186.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_sql_injection_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateSqlInjectionMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_189) = &input.sql_injection_match_set_id {
        object.key("SqlInjectionMatchSetId").string(var_189);
    }
    if let Some(var_190) = &input.change_token {
        object.key("ChangeToken").string(var_190);
    }
    if let Some(var_191) = &input.updates {
        let mut array_192 = object.key("Updates").start_array();
        for item_193 in var_191 {
            {
                let mut object_194 = array_192.value().start_object();
                crate::json_ser::serialize_structure_crate_model_sql_injection_match_set_update(
                    &mut object_194,
                    item_193,
                )?;
                object_194.finish();
            }
        }
        array_192.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_web_acl_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateWebAclInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_195) = &input.web_acl_id {
        object.key("WebACLId").string(var_195);
    }
    if let Some(var_196) = &input.change_token {
        object.key("ChangeToken").string(var_196);
    }
    if let Some(var_197) = &input.updates {
        let mut array_198 = object.key("Updates").start_array();
        for item_199 in var_197 {
            {
                let mut object_200 = array_198.value().start_object();
                crate::json_ser::serialize_structure_crate_model_web_acl_update(
                    &mut object_200,
                    item_199,
                )?;
                object_200.finish();
            }
        }
        array_198.finish();
    }
    if let Some(var_201) = &input.default_action {
        let mut object_202 = object.key("DefaultAction").start_object();
        crate::json_ser::serialize_structure_crate_model_waf_action(&mut object_202, var_201)?;
        object_202.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_input_update_xss_match_set_input(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::input::UpdateXssMatchSetInput,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_203) = &input.xss_match_set_id {
        object.key("XssMatchSetId").string(var_203);
    }
    if let Some(var_204) = &input.change_token {
        object.key("ChangeToken").string(var_204);
    }
    if let Some(var_205) = &input.updates {
        let mut array_206 = object.key("Updates").start_array();
        for item_207 in var_205 {
            {
                let mut object_208 = array_206.value().start_object();
                crate::json_ser::serialize_structure_crate_model_xss_match_set_update(
                    &mut object_208,
                    item_207,
                )?;
                object_208.finish();
            }
        }
        array_206.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_tag(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Tag,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_209) = &input.key {
        object.key("Key").string(var_209);
    }
    if let Some(var_210) = &input.value {
        object.key("Value").string(var_210);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_waf_action(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::WafAction,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_211) = &input.r#type {
        object.key("Type").string(var_211.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_time_window(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::TimeWindow,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_212) = &input.start_time {
        object
            .key("StartTime")
            .date_time(var_212, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    if let Some(var_213) = &input.end_time {
        object
            .key("EndTime")
            .date_time(var_213, aws_smithy_types::date_time::Format::EpochSeconds)?;
    }
    Ok(())
}

pub fn serialize_structure_crate_model_logging_configuration(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::LoggingConfiguration,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_214) = &input.resource_arn {
        object.key("ResourceArn").string(var_214);
    }
    if let Some(var_215) = &input.log_destination_configs {
        let mut array_216 = object.key("LogDestinationConfigs").start_array();
        for item_217 in var_215 {
            {
                array_216.value().string(item_217);
            }
        }
        array_216.finish();
    }
    if let Some(var_218) = &input.redacted_fields {
        let mut array_219 = object.key("RedactedFields").start_array();
        for item_220 in var_218 {
            {
                let mut object_221 = array_219.value().start_object();
                crate::json_ser::serialize_structure_crate_model_field_to_match(
                    &mut object_221,
                    item_220,
                )?;
                object_221.finish();
            }
        }
        array_219.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_byte_match_set_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::ByteMatchSetUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_222) = &input.action {
        object.key("Action").string(var_222.as_str());
    }
    if let Some(var_223) = &input.byte_match_tuple {
        let mut object_224 = object.key("ByteMatchTuple").start_object();
        crate::json_ser::serialize_structure_crate_model_byte_match_tuple(
            &mut object_224,
            var_223,
        )?;
        object_224.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_geo_match_set_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::GeoMatchSetUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_225) = &input.action {
        object.key("Action").string(var_225.as_str());
    }
    if let Some(var_226) = &input.geo_match_constraint {
        let mut object_227 = object.key("GeoMatchConstraint").start_object();
        crate::json_ser::serialize_structure_crate_model_geo_match_constraint(
            &mut object_227,
            var_226,
        )?;
        object_227.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_ip_set_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::IpSetUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_228) = &input.action {
        object.key("Action").string(var_228.as_str());
    }
    if let Some(var_229) = &input.ip_set_descriptor {
        let mut object_230 = object.key("IPSetDescriptor").start_object();
        crate::json_ser::serialize_structure_crate_model_ip_set_descriptor(
            &mut object_230,
            var_229,
        )?;
        object_230.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_rule_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::RuleUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_231) = &input.action {
        object.key("Action").string(var_231.as_str());
    }
    if let Some(var_232) = &input.predicate {
        let mut object_233 = object.key("Predicate").start_object();
        crate::json_ser::serialize_structure_crate_model_predicate(&mut object_233, var_232)?;
        object_233.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_regex_match_set_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::RegexMatchSetUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_234) = &input.action {
        object.key("Action").string(var_234.as_str());
    }
    if let Some(var_235) = &input.regex_match_tuple {
        let mut object_236 = object.key("RegexMatchTuple").start_object();
        crate::json_ser::serialize_structure_crate_model_regex_match_tuple(
            &mut object_236,
            var_235,
        )?;
        object_236.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_regex_pattern_set_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::RegexPatternSetUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_237) = &input.action {
        object.key("Action").string(var_237.as_str());
    }
    if let Some(var_238) = &input.regex_pattern_string {
        object.key("RegexPatternString").string(var_238);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_rule_group_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::RuleGroupUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_239) = &input.action {
        object.key("Action").string(var_239.as_str());
    }
    if let Some(var_240) = &input.activated_rule {
        let mut object_241 = object.key("ActivatedRule").start_object();
        crate::json_ser::serialize_structure_crate_model_activated_rule(&mut object_241, var_240)?;
        object_241.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_size_constraint_set_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::SizeConstraintSetUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_242) = &input.action {
        object.key("Action").string(var_242.as_str());
    }
    if let Some(var_243) = &input.size_constraint {
        let mut object_244 = object.key("SizeConstraint").start_object();
        crate::json_ser::serialize_structure_crate_model_size_constraint(&mut object_244, var_243)?;
        object_244.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_sql_injection_match_set_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::SqlInjectionMatchSetUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_245) = &input.action {
        object.key("Action").string(var_245.as_str());
    }
    if let Some(var_246) = &input.sql_injection_match_tuple {
        let mut object_247 = object.key("SqlInjectionMatchTuple").start_object();
        crate::json_ser::serialize_structure_crate_model_sql_injection_match_tuple(
            &mut object_247,
            var_246,
        )?;
        object_247.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_web_acl_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::WebAclUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_248) = &input.action {
        object.key("Action").string(var_248.as_str());
    }
    if let Some(var_249) = &input.activated_rule {
        let mut object_250 = object.key("ActivatedRule").start_object();
        crate::json_ser::serialize_structure_crate_model_activated_rule(&mut object_250, var_249)?;
        object_250.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_xss_match_set_update(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::XssMatchSetUpdate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_251) = &input.action {
        object.key("Action").string(var_251.as_str());
    }
    if let Some(var_252) = &input.xss_match_tuple {
        let mut object_253 = object.key("XssMatchTuple").start_object();
        crate::json_ser::serialize_structure_crate_model_xss_match_tuple(&mut object_253, var_252)?;
        object_253.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_field_to_match(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::FieldToMatch,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_254) = &input.r#type {
        object.key("Type").string(var_254.as_str());
    }
    if let Some(var_255) = &input.data {
        object.key("Data").string(var_255);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_byte_match_tuple(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::ByteMatchTuple,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_256) = &input.field_to_match {
        let mut object_257 = object.key("FieldToMatch").start_object();
        crate::json_ser::serialize_structure_crate_model_field_to_match(&mut object_257, var_256)?;
        object_257.finish();
    }
    if let Some(var_258) = &input.target_string {
        object
            .key("TargetString")
            .string_unchecked(&aws_smithy_types::base64::encode(var_258));
    }
    if let Some(var_259) = &input.text_transformation {
        object.key("TextTransformation").string(var_259.as_str());
    }
    if let Some(var_260) = &input.positional_constraint {
        object.key("PositionalConstraint").string(var_260.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_geo_match_constraint(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::GeoMatchConstraint,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_261) = &input.r#type {
        object.key("Type").string(var_261.as_str());
    }
    if let Some(var_262) = &input.value {
        object.key("Value").string(var_262.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_ip_set_descriptor(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::IpSetDescriptor,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_263) = &input.r#type {
        object.key("Type").string(var_263.as_str());
    }
    if let Some(var_264) = &input.value {
        object.key("Value").string(var_264);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_predicate(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::Predicate,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_265) = &input.negated {
        object.key("Negated").boolean(*var_265);
    }
    if let Some(var_266) = &input.r#type {
        object.key("Type").string(var_266.as_str());
    }
    if let Some(var_267) = &input.data_id {
        object.key("DataId").string(var_267);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_regex_match_tuple(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::RegexMatchTuple,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_268) = &input.field_to_match {
        let mut object_269 = object.key("FieldToMatch").start_object();
        crate::json_ser::serialize_structure_crate_model_field_to_match(&mut object_269, var_268)?;
        object_269.finish();
    }
    if let Some(var_270) = &input.text_transformation {
        object.key("TextTransformation").string(var_270.as_str());
    }
    if let Some(var_271) = &input.regex_pattern_set_id {
        object.key("RegexPatternSetId").string(var_271);
    }
    Ok(())
}

pub fn serialize_structure_crate_model_activated_rule(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::ActivatedRule,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_272) = &input.priority {
        object.key("Priority").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((*var_272).into()),
        );
    }
    if let Some(var_273) = &input.rule_id {
        object.key("RuleId").string(var_273);
    }
    if let Some(var_274) = &input.action {
        let mut object_275 = object.key("Action").start_object();
        crate::json_ser::serialize_structure_crate_model_waf_action(&mut object_275, var_274)?;
        object_275.finish();
    }
    if let Some(var_276) = &input.override_action {
        let mut object_277 = object.key("OverrideAction").start_object();
        crate::json_ser::serialize_structure_crate_model_waf_override_action(
            &mut object_277,
            var_276,
        )?;
        object_277.finish();
    }
    if let Some(var_278) = &input.r#type {
        object.key("Type").string(var_278.as_str());
    }
    if let Some(var_279) = &input.excluded_rules {
        let mut array_280 = object.key("ExcludedRules").start_array();
        for item_281 in var_279 {
            {
                let mut object_282 = array_280.value().start_object();
                crate::json_ser::serialize_structure_crate_model_excluded_rule(
                    &mut object_282,
                    item_281,
                )?;
                object_282.finish();
            }
        }
        array_280.finish();
    }
    Ok(())
}

pub fn serialize_structure_crate_model_size_constraint(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::SizeConstraint,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_283) = &input.field_to_match {
        let mut object_284 = object.key("FieldToMatch").start_object();
        crate::json_ser::serialize_structure_crate_model_field_to_match(&mut object_284, var_283)?;
        object_284.finish();
    }
    if let Some(var_285) = &input.text_transformation {
        object.key("TextTransformation").string(var_285.as_str());
    }
    if let Some(var_286) = &input.comparison_operator {
        object.key("ComparisonOperator").string(var_286.as_str());
    }
    {
        object.key("Size").number(
            #[allow(clippy::useless_conversion)]
            aws_smithy_types::Number::NegInt((input.size).into()),
        );
    }
    Ok(())
}

pub fn serialize_structure_crate_model_sql_injection_match_tuple(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::SqlInjectionMatchTuple,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_287) = &input.field_to_match {
        let mut object_288 = object.key("FieldToMatch").start_object();
        crate::json_ser::serialize_structure_crate_model_field_to_match(&mut object_288, var_287)?;
        object_288.finish();
    }
    if let Some(var_289) = &input.text_transformation {
        object.key("TextTransformation").string(var_289.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_xss_match_tuple(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::XssMatchTuple,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_290) = &input.field_to_match {
        let mut object_291 = object.key("FieldToMatch").start_object();
        crate::json_ser::serialize_structure_crate_model_field_to_match(&mut object_291, var_290)?;
        object_291.finish();
    }
    if let Some(var_292) = &input.text_transformation {
        object.key("TextTransformation").string(var_292.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_waf_override_action(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::WafOverrideAction,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_293) = &input.r#type {
        object.key("Type").string(var_293.as_str());
    }
    Ok(())
}

pub fn serialize_structure_crate_model_excluded_rule(
    object: &mut aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::model::ExcludedRule,
) -> Result<(), aws_smithy_http::operation::SerializationError> {
    if let Some(var_294) = &input.rule_id {
        object.key("RuleId").string(var_294);
    }
    Ok(())
}
