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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Represents a single sampled web request. The response from <code>GetSampledRequests</code> includes a <code>SampledHTTPRequests</code> complex type that appears as <code>SampledRequests</code> in the response syntax. <code>SampledHTTPRequests</code> contains an array of <code>SampledHTTPRequest</code> objects.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct SampledHttpRequest {
/// <p>A complex type that contains detailed information about the request.</p>
pub request: ::std::option::Option<crate::types::HttpRequest>,
/// <p>A value that indicates how one result in the response relates proportionally to other results in the response. For example, a result that has a weight of <code>2</code> represents roughly twice as many web requests as a result that has a weight of <code>1</code>.</p>
pub weight: i64,
/// <p>The time at which WAF received the request from your Amazon Web Services resource, in Unix time format (in seconds).</p>
pub timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
/// <p>The action that WAF applied to the request.</p>
pub action: ::std::option::Option<::std::string::String>,
/// <p>The name of the <code>Rule</code> that the request matched. For managed rule groups, the format for this name is <code><vendor name>
/// #
/// <managed rule group name>
/// #
/// <rule name></rule>
/// </managed>
/// </vendor></code>. For your own rule groups, the format for this name is <code><rule group name>
/// #
/// <rule name></rule>
/// </rule></code>. If the rule is not in a rule group, this field is absent.</p>
pub rule_name_within_rule_group: ::std::option::Option<::std::string::String>,
/// <p>Custom request headers inserted by WAF into the request, according to the custom request configuration for the matching rule action.</p>
pub request_headers_inserted: ::std::option::Option<::std::vec::Vec<crate::types::HttpHeader>>,
/// <p>The response code that was sent for the request.</p>
pub response_code_sent: ::std::option::Option<i32>,
/// <p>Labels applied to the web request by matching rules. WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.</p>
/// <p>For example, <code>awswaf:111122223333:myRuleGroup:testRules:testNS1:testNS2:labelNameA</code> or <code>awswaf:managed:aws:managed-rule-set:header:encoding:utf8</code>.</p>
pub labels: ::std::option::Option<::std::vec::Vec<crate::types::Label>>,
/// <p>The <code>CAPTCHA</code> response for the request.</p>
pub captcha_response: ::std::option::Option<crate::types::CaptchaResponse>,
/// <p>The <code>Challenge</code> response for the request.</p>
pub challenge_response: ::std::option::Option<crate::types::ChallengeResponse>,
/// <p>Used only for rule group rules that have a rule action override in place in the web ACL. This is the action that the rule group rule is configured for, and not the action that was applied to the request. The action that WAF applied is the <code>Action</code> value.</p>
pub overridden_action: ::std::option::Option<::std::string::String>,
}
impl SampledHttpRequest {
/// <p>A complex type that contains detailed information about the request.</p>
pub fn request(&self) -> ::std::option::Option<&crate::types::HttpRequest> {
self.request.as_ref()
}
/// <p>A value that indicates how one result in the response relates proportionally to other results in the response. For example, a result that has a weight of <code>2</code> represents roughly twice as many web requests as a result that has a weight of <code>1</code>.</p>
pub fn weight(&self) -> i64 {
self.weight
}
/// <p>The time at which WAF received the request from your Amazon Web Services resource, in Unix time format (in seconds).</p>
pub fn timestamp(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
self.timestamp.as_ref()
}
/// <p>The action that WAF applied to the request.</p>
pub fn action(&self) -> ::std::option::Option<&str> {
self.action.as_deref()
}
/// <p>The name of the <code>Rule</code> that the request matched. For managed rule groups, the format for this name is <code><vendor name>
/// #
/// <managed rule group name>
/// #
/// <rule name></rule>
/// </managed>
/// </vendor></code>. For your own rule groups, the format for this name is <code><rule group name>
/// #
/// <rule name></rule>
/// </rule></code>. If the rule is not in a rule group, this field is absent.</p>
pub fn rule_name_within_rule_group(&self) -> ::std::option::Option<&str> {
self.rule_name_within_rule_group.as_deref()
}
/// <p>Custom request headers inserted by WAF into the request, according to the custom request configuration for the matching rule action.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.request_headers_inserted.is_none()`.
pub fn request_headers_inserted(&self) -> &[crate::types::HttpHeader] {
self.request_headers_inserted.as_deref().unwrap_or_default()
}
/// <p>The response code that was sent for the request.</p>
pub fn response_code_sent(&self) -> ::std::option::Option<i32> {
self.response_code_sent
}
/// <p>Labels applied to the web request by matching rules. WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.</p>
/// <p>For example, <code>awswaf:111122223333:myRuleGroup:testRules:testNS1:testNS2:labelNameA</code> or <code>awswaf:managed:aws:managed-rule-set:header:encoding:utf8</code>.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.labels.is_none()`.
pub fn labels(&self) -> &[crate::types::Label] {
self.labels.as_deref().unwrap_or_default()
}
/// <p>The <code>CAPTCHA</code> response for the request.</p>
pub fn captcha_response(&self) -> ::std::option::Option<&crate::types::CaptchaResponse> {
self.captcha_response.as_ref()
}
/// <p>The <code>Challenge</code> response for the request.</p>
pub fn challenge_response(&self) -> ::std::option::Option<&crate::types::ChallengeResponse> {
self.challenge_response.as_ref()
}
/// <p>Used only for rule group rules that have a rule action override in place in the web ACL. This is the action that the rule group rule is configured for, and not the action that was applied to the request. The action that WAF applied is the <code>Action</code> value.</p>
pub fn overridden_action(&self) -> ::std::option::Option<&str> {
self.overridden_action.as_deref()
}
}
impl SampledHttpRequest {
/// Creates a new builder-style object to manufacture [`SampledHttpRequest`](crate::types::SampledHttpRequest).
pub fn builder() -> crate::types::builders::SampledHttpRequestBuilder {
crate::types::builders::SampledHttpRequestBuilder::default()
}
}
/// A builder for [`SampledHttpRequest`](crate::types::SampledHttpRequest).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct SampledHttpRequestBuilder {
pub(crate) request: ::std::option::Option<crate::types::HttpRequest>,
pub(crate) weight: ::std::option::Option<i64>,
pub(crate) timestamp: ::std::option::Option<::aws_smithy_types::DateTime>,
pub(crate) action: ::std::option::Option<::std::string::String>,
pub(crate) rule_name_within_rule_group: ::std::option::Option<::std::string::String>,
pub(crate) request_headers_inserted: ::std::option::Option<::std::vec::Vec<crate::types::HttpHeader>>,
pub(crate) response_code_sent: ::std::option::Option<i32>,
pub(crate) labels: ::std::option::Option<::std::vec::Vec<crate::types::Label>>,
pub(crate) captcha_response: ::std::option::Option<crate::types::CaptchaResponse>,
pub(crate) challenge_response: ::std::option::Option<crate::types::ChallengeResponse>,
pub(crate) overridden_action: ::std::option::Option<::std::string::String>,
}
impl SampledHttpRequestBuilder {
/// <p>A complex type that contains detailed information about the request.</p>
/// This field is required.
pub fn request(mut self, input: crate::types::HttpRequest) -> Self {
self.request = ::std::option::Option::Some(input);
self
}
/// <p>A complex type that contains detailed information about the request.</p>
pub fn set_request(mut self, input: ::std::option::Option<crate::types::HttpRequest>) -> Self {
self.request = input;
self
}
/// <p>A complex type that contains detailed information about the request.</p>
pub fn get_request(&self) -> &::std::option::Option<crate::types::HttpRequest> {
&self.request
}
/// <p>A value that indicates how one result in the response relates proportionally to other results in the response. For example, a result that has a weight of <code>2</code> represents roughly twice as many web requests as a result that has a weight of <code>1</code>.</p>
/// This field is required.
pub fn weight(mut self, input: i64) -> Self {
self.weight = ::std::option::Option::Some(input);
self
}
/// <p>A value that indicates how one result in the response relates proportionally to other results in the response. For example, a result that has a weight of <code>2</code> represents roughly twice as many web requests as a result that has a weight of <code>1</code>.</p>
pub fn set_weight(mut self, input: ::std::option::Option<i64>) -> Self {
self.weight = input;
self
}
/// <p>A value that indicates how one result in the response relates proportionally to other results in the response. For example, a result that has a weight of <code>2</code> represents roughly twice as many web requests as a result that has a weight of <code>1</code>.</p>
pub fn get_weight(&self) -> &::std::option::Option<i64> {
&self.weight
}
/// <p>The time at which WAF received the request from your Amazon Web Services resource, in Unix time format (in seconds).</p>
pub fn timestamp(mut self, input: ::aws_smithy_types::DateTime) -> Self {
self.timestamp = ::std::option::Option::Some(input);
self
}
/// <p>The time at which WAF received the request from your Amazon Web Services resource, in Unix time format (in seconds).</p>
pub fn set_timestamp(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
self.timestamp = input;
self
}
/// <p>The time at which WAF received the request from your Amazon Web Services resource, in Unix time format (in seconds).</p>
pub fn get_timestamp(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
&self.timestamp
}
/// <p>The action that WAF applied to the request.</p>
pub fn action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.action = ::std::option::Option::Some(input.into());
self
}
/// <p>The action that WAF applied to the request.</p>
pub fn set_action(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.action = input;
self
}
/// <p>The action that WAF applied to the request.</p>
pub fn get_action(&self) -> &::std::option::Option<::std::string::String> {
&self.action
}
/// <p>The name of the <code>Rule</code> that the request matched. For managed rule groups, the format for this name is <code><vendor name>
/// #
/// <managed rule group name>
/// #
/// <rule name></rule>
/// </managed>
/// </vendor></code>. For your own rule groups, the format for this name is <code><rule group name>
/// #
/// <rule name></rule>
/// </rule></code>. If the rule is not in a rule group, this field is absent.</p>
pub fn rule_name_within_rule_group(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.rule_name_within_rule_group = ::std::option::Option::Some(input.into());
self
}
/// <p>The name of the <code>Rule</code> that the request matched. For managed rule groups, the format for this name is <code><vendor name>
/// #
/// <managed rule group name>
/// #
/// <rule name></rule>
/// </managed>
/// </vendor></code>. For your own rule groups, the format for this name is <code><rule group name>
/// #
/// <rule name></rule>
/// </rule></code>. If the rule is not in a rule group, this field is absent.</p>
pub fn set_rule_name_within_rule_group(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.rule_name_within_rule_group = input;
self
}
/// <p>The name of the <code>Rule</code> that the request matched. For managed rule groups, the format for this name is <code><vendor name>
/// #
/// <managed rule group name>
/// #
/// <rule name></rule>
/// </managed>
/// </vendor></code>. For your own rule groups, the format for this name is <code><rule group name>
/// #
/// <rule name></rule>
/// </rule></code>. If the rule is not in a rule group, this field is absent.</p>
pub fn get_rule_name_within_rule_group(&self) -> &::std::option::Option<::std::string::String> {
&self.rule_name_within_rule_group
}
/// Appends an item to `request_headers_inserted`.
///
/// To override the contents of this collection use [`set_request_headers_inserted`](Self::set_request_headers_inserted).
///
/// <p>Custom request headers inserted by WAF into the request, according to the custom request configuration for the matching rule action.</p>
pub fn request_headers_inserted(mut self, input: crate::types::HttpHeader) -> Self {
let mut v = self.request_headers_inserted.unwrap_or_default();
v.push(input);
self.request_headers_inserted = ::std::option::Option::Some(v);
self
}
/// <p>Custom request headers inserted by WAF into the request, according to the custom request configuration for the matching rule action.</p>
pub fn set_request_headers_inserted(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::HttpHeader>>) -> Self {
self.request_headers_inserted = input;
self
}
/// <p>Custom request headers inserted by WAF into the request, according to the custom request configuration for the matching rule action.</p>
pub fn get_request_headers_inserted(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::HttpHeader>> {
&self.request_headers_inserted
}
/// <p>The response code that was sent for the request.</p>
pub fn response_code_sent(mut self, input: i32) -> Self {
self.response_code_sent = ::std::option::Option::Some(input);
self
}
/// <p>The response code that was sent for the request.</p>
pub fn set_response_code_sent(mut self, input: ::std::option::Option<i32>) -> Self {
self.response_code_sent = input;
self
}
/// <p>The response code that was sent for the request.</p>
pub fn get_response_code_sent(&self) -> &::std::option::Option<i32> {
&self.response_code_sent
}
/// Appends an item to `labels`.
///
/// To override the contents of this collection use [`set_labels`](Self::set_labels).
///
/// <p>Labels applied to the web request by matching rules. WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.</p>
/// <p>For example, <code>awswaf:111122223333:myRuleGroup:testRules:testNS1:testNS2:labelNameA</code> or <code>awswaf:managed:aws:managed-rule-set:header:encoding:utf8</code>.</p>
pub fn labels(mut self, input: crate::types::Label) -> Self {
let mut v = self.labels.unwrap_or_default();
v.push(input);
self.labels = ::std::option::Option::Some(v);
self
}
/// <p>Labels applied to the web request by matching rules. WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.</p>
/// <p>For example, <code>awswaf:111122223333:myRuleGroup:testRules:testNS1:testNS2:labelNameA</code> or <code>awswaf:managed:aws:managed-rule-set:header:encoding:utf8</code>.</p>
pub fn set_labels(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Label>>) -> Self {
self.labels = input;
self
}
/// <p>Labels applied to the web request by matching rules. WAF applies fully qualified labels to matching web requests. A fully qualified label is the concatenation of a label namespace and a rule label. The rule's rule group or web ACL defines the label namespace.</p>
/// <p>For example, <code>awswaf:111122223333:myRuleGroup:testRules:testNS1:testNS2:labelNameA</code> or <code>awswaf:managed:aws:managed-rule-set:header:encoding:utf8</code>.</p>
pub fn get_labels(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Label>> {
&self.labels
}
/// <p>The <code>CAPTCHA</code> response for the request.</p>
pub fn captcha_response(mut self, input: crate::types::CaptchaResponse) -> Self {
self.captcha_response = ::std::option::Option::Some(input);
self
}
/// <p>The <code>CAPTCHA</code> response for the request.</p>
pub fn set_captcha_response(mut self, input: ::std::option::Option<crate::types::CaptchaResponse>) -> Self {
self.captcha_response = input;
self
}
/// <p>The <code>CAPTCHA</code> response for the request.</p>
pub fn get_captcha_response(&self) -> &::std::option::Option<crate::types::CaptchaResponse> {
&self.captcha_response
}
/// <p>The <code>Challenge</code> response for the request.</p>
pub fn challenge_response(mut self, input: crate::types::ChallengeResponse) -> Self {
self.challenge_response = ::std::option::Option::Some(input);
self
}
/// <p>The <code>Challenge</code> response for the request.</p>
pub fn set_challenge_response(mut self, input: ::std::option::Option<crate::types::ChallengeResponse>) -> Self {
self.challenge_response = input;
self
}
/// <p>The <code>Challenge</code> response for the request.</p>
pub fn get_challenge_response(&self) -> &::std::option::Option<crate::types::ChallengeResponse> {
&self.challenge_response
}
/// <p>Used only for rule group rules that have a rule action override in place in the web ACL. This is the action that the rule group rule is configured for, and not the action that was applied to the request. The action that WAF applied is the <code>Action</code> value.</p>
pub fn overridden_action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.overridden_action = ::std::option::Option::Some(input.into());
self
}
/// <p>Used only for rule group rules that have a rule action override in place in the web ACL. This is the action that the rule group rule is configured for, and not the action that was applied to the request. The action that WAF applied is the <code>Action</code> value.</p>
pub fn set_overridden_action(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.overridden_action = input;
self
}
/// <p>Used only for rule group rules that have a rule action override in place in the web ACL. This is the action that the rule group rule is configured for, and not the action that was applied to the request. The action that WAF applied is the <code>Action</code> value.</p>
pub fn get_overridden_action(&self) -> &::std::option::Option<::std::string::String> {
&self.overridden_action
}
/// Consumes the builder and constructs a [`SampledHttpRequest`](crate::types::SampledHttpRequest).
pub fn build(self) -> crate::types::SampledHttpRequest {
crate::types::SampledHttpRequest {
request: self.request,
weight: self.weight.unwrap_or_default(),
timestamp: self.timestamp,
action: self.action,
rule_name_within_rule_group: self.rule_name_within_rule_group,
request_headers_inserted: self.request_headers_inserted,
response_code_sent: self.response_code_sent,
labels: self.labels,
captcha_response: self.captcha_response,
challenge_response: self.challenge_response,
overridden_action: self.overridden_action,
}
}
}