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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>The name of the field in the request payload that contains your customer's username.</p>
/// <p>This data type is used in the <code>RequestInspection</code> and <code>RequestInspectionACFP</code> data types.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct UsernameField {
/// <p>The name of the username field.</p>
/// <p>How you specify this depends on the request inspection payload type.</p>
/// <ul>
/// <li>
/// <p>For JSON payloads, specify the field name in JSON pointer syntax. For information about the JSON Pointer syntax, see the Internet Engineering Task Force (IETF) documentation <a href="https://tools.ietf.org/html/rfc6901">JavaScript Object Notation (JSON) Pointer</a>.</p>
/// <p>For example, for the JSON payload <code>{ "form": { "username": "THE_USERNAME" } }</code>, the username field specification is <code>/form/username</code>.</p></li>
/// <li>
/// <p>For form encoded payload types, use the HTML form names.</p>
/// <p>For example, for an HTML form with the input element named <code>username1</code>, the username field specification is <code>username1</code></p></li>
/// </ul>
pub identifier: ::std::string::String,
}
impl UsernameField {
/// <p>The name of the username field.</p>
/// <p>How you specify this depends on the request inspection payload type.</p>
/// <ul>
/// <li>
/// <p>For JSON payloads, specify the field name in JSON pointer syntax. For information about the JSON Pointer syntax, see the Internet Engineering Task Force (IETF) documentation <a href="https://tools.ietf.org/html/rfc6901">JavaScript Object Notation (JSON) Pointer</a>.</p>
/// <p>For example, for the JSON payload <code>{ "form": { "username": "THE_USERNAME" } }</code>, the username field specification is <code>/form/username</code>.</p></li>
/// <li>
/// <p>For form encoded payload types, use the HTML form names.</p>
/// <p>For example, for an HTML form with the input element named <code>username1</code>, the username field specification is <code>username1</code></p></li>
/// </ul>
pub fn identifier(&self) -> &str {
use std::ops::Deref;
self.identifier.deref()
}
}
impl UsernameField {
/// Creates a new builder-style object to manufacture [`UsernameField`](crate::types::UsernameField).
pub fn builder() -> crate::types::builders::UsernameFieldBuilder {
crate::types::builders::UsernameFieldBuilder::default()
}
}
/// A builder for [`UsernameField`](crate::types::UsernameField).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct UsernameFieldBuilder {
pub(crate) identifier: ::std::option::Option<::std::string::String>,
}
impl UsernameFieldBuilder {
/// <p>The name of the username field.</p>
/// <p>How you specify this depends on the request inspection payload type.</p>
/// <ul>
/// <li>
/// <p>For JSON payloads, specify the field name in JSON pointer syntax. For information about the JSON Pointer syntax, see the Internet Engineering Task Force (IETF) documentation <a href="https://tools.ietf.org/html/rfc6901">JavaScript Object Notation (JSON) Pointer</a>.</p>
/// <p>For example, for the JSON payload <code>{ "form": { "username": "THE_USERNAME" } }</code>, the username field specification is <code>/form/username</code>.</p></li>
/// <li>
/// <p>For form encoded payload types, use the HTML form names.</p>
/// <p>For example, for an HTML form with the input element named <code>username1</code>, the username field specification is <code>username1</code></p></li>
/// </ul>
/// This field is required.
pub fn identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.identifier = ::std::option::Option::Some(input.into());
self
}
/// <p>The name of the username field.</p>
/// <p>How you specify this depends on the request inspection payload type.</p>
/// <ul>
/// <li>
/// <p>For JSON payloads, specify the field name in JSON pointer syntax. For information about the JSON Pointer syntax, see the Internet Engineering Task Force (IETF) documentation <a href="https://tools.ietf.org/html/rfc6901">JavaScript Object Notation (JSON) Pointer</a>.</p>
/// <p>For example, for the JSON payload <code>{ "form": { "username": "THE_USERNAME" } }</code>, the username field specification is <code>/form/username</code>.</p></li>
/// <li>
/// <p>For form encoded payload types, use the HTML form names.</p>
/// <p>For example, for an HTML form with the input element named <code>username1</code>, the username field specification is <code>username1</code></p></li>
/// </ul>
pub fn set_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.identifier = input;
self
}
/// <p>The name of the username field.</p>
/// <p>How you specify this depends on the request inspection payload type.</p>
/// <ul>
/// <li>
/// <p>For JSON payloads, specify the field name in JSON pointer syntax. For information about the JSON Pointer syntax, see the Internet Engineering Task Force (IETF) documentation <a href="https://tools.ietf.org/html/rfc6901">JavaScript Object Notation (JSON) Pointer</a>.</p>
/// <p>For example, for the JSON payload <code>{ "form": { "username": "THE_USERNAME" } }</code>, the username field specification is <code>/form/username</code>.</p></li>
/// <li>
/// <p>For form encoded payload types, use the HTML form names.</p>
/// <p>For example, for an HTML form with the input element named <code>username1</code>, the username field specification is <code>username1</code></p></li>
/// </ul>
pub fn get_identifier(&self) -> &::std::option::Option<::std::string::String> {
&self.identifier
}
/// Consumes the builder and constructs a [`UsernameField`](crate::types::UsernameField).
/// This method will fail if any of the following fields are not set:
/// - [`identifier`](crate::types::builders::UsernameFieldBuilder::identifier)
pub fn build(self) -> ::std::result::Result<crate::types::UsernameField, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::UsernameField {
identifier: self.identifier.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"identifier",
"identifier was not specified but it is required when building UsernameField",
)
})?,
})
}
}