1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Specifies that WAF should run a <code>CAPTCHA</code> check against the request:</p>
/// <ul>
/// <li>
/// <p>If the request includes a valid, unexpired <code>CAPTCHA</code> token, WAF applies any custom request handling and labels that you've configured and then allows the web request inspection to proceed to the next rule, similar to a <code>CountAction</code>.</p></li>
/// <li>
/// <p>If the request doesn't include a valid, unexpired token, WAF discontinues the web ACL evaluation of the request and blocks it from going to its intended destination.</p>
/// <p>WAF generates a response that it sends back to the client, which includes the following:</p>
/// <ul>
/// <li>
/// <p>The header <code>x-amzn-waf-action</code> with a value of <code>captcha</code>.</p></li>
/// <li>
/// <p>The HTTP status code <code>405 Method Not Allowed</code>.</p></li>
/// <li>
/// <p>If the request contains an <code>Accept</code> header with a value of <code>text/html</code>, the response includes a <code>CAPTCHA</code> JavaScript page interstitial.</p></li>
/// </ul></li>
/// </ul>
/// <p>You can configure the expiration time in the <code>CaptchaConfig</code> <code>ImmunityTimeProperty</code> setting at the rule and web ACL level. The rule setting overrides the web ACL setting.</p>
/// <p>This action option is available for rules. It isn't available for web ACL default actions.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CaptchaAction {
/// <p>Defines custom handling for the web request, used when the <code>CAPTCHA</code> inspection determines that the request's token is valid and unexpired.</p>
/// <p>For information about customizing web requests and responses, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html">Customizing web requests and responses in WAF</a> in the <i>WAF Developer Guide</i>.</p>
pub custom_request_handling: ::std::option::Option<crate::types::CustomRequestHandling>,
}
impl CaptchaAction {
/// <p>Defines custom handling for the web request, used when the <code>CAPTCHA</code> inspection determines that the request's token is valid and unexpired.</p>
/// <p>For information about customizing web requests and responses, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html">Customizing web requests and responses in WAF</a> in the <i>WAF Developer Guide</i>.</p>
pub fn custom_request_handling(&self) -> ::std::option::Option<&crate::types::CustomRequestHandling> {
self.custom_request_handling.as_ref()
}
}
impl CaptchaAction {
/// Creates a new builder-style object to manufacture [`CaptchaAction`](crate::types::CaptchaAction).
pub fn builder() -> crate::types::builders::CaptchaActionBuilder {
crate::types::builders::CaptchaActionBuilder::default()
}
}
/// A builder for [`CaptchaAction`](crate::types::CaptchaAction).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct CaptchaActionBuilder {
pub(crate) custom_request_handling: ::std::option::Option<crate::types::CustomRequestHandling>,
}
impl CaptchaActionBuilder {
/// <p>Defines custom handling for the web request, used when the <code>CAPTCHA</code> inspection determines that the request's token is valid and unexpired.</p>
/// <p>For information about customizing web requests and responses, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html">Customizing web requests and responses in WAF</a> in the <i>WAF Developer Guide</i>.</p>
pub fn custom_request_handling(mut self, input: crate::types::CustomRequestHandling) -> Self {
self.custom_request_handling = ::std::option::Option::Some(input);
self
}
/// <p>Defines custom handling for the web request, used when the <code>CAPTCHA</code> inspection determines that the request's token is valid and unexpired.</p>
/// <p>For information about customizing web requests and responses, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html">Customizing web requests and responses in WAF</a> in the <i>WAF Developer Guide</i>.</p>
pub fn set_custom_request_handling(mut self, input: ::std::option::Option<crate::types::CustomRequestHandling>) -> Self {
self.custom_request_handling = input;
self
}
/// <p>Defines custom handling for the web request, used when the <code>CAPTCHA</code> inspection determines that the request's token is valid and unexpired.</p>
/// <p>For information about customizing web requests and responses, see <a href="https://docs.aws.amazon.com/waf/latest/developerguide/waf-custom-request-response.html">Customizing web requests and responses in WAF</a> in the <i>WAF Developer Guide</i>.</p>
pub fn get_custom_request_handling(&self) -> &::std::option::Option<crate::types::CustomRequestHandling> {
&self.custom_request_handling
}
/// Consumes the builder and constructs a [`CaptchaAction`](crate::types::CaptchaAction).
pub fn build(self) -> crate::types::CaptchaAction {
crate::types::CaptchaAction {
custom_request_handling: self.custom_request_handling,
}
}
}