aws_sdk_cloudfront/operation/test_function/
_test_function_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
5pub struct TestFunctionInput {
6    /// <p>The name of the function that you are testing.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>The current version (<code>ETag</code> value) of the function that you are testing, which you can get using <code>DescribeFunction</code>.</p>
9    pub if_match: ::std::option::Option<::std::string::String>,
10    /// <p>The stage of the function that you are testing, either <code>DEVELOPMENT</code> or <code>LIVE</code>.</p>
11    pub stage: ::std::option::Option<crate::types::FunctionStage>,
12    /// <p>The event object to test the function with. For more information about the structure of the event object, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/managing-functions.html#test-function">Testing functions</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
13    pub event_object: ::std::option::Option<::aws_smithy_types::Blob>,
14}
15impl TestFunctionInput {
16    /// <p>The name of the function that you are testing.</p>
17    pub fn name(&self) -> ::std::option::Option<&str> {
18        self.name.as_deref()
19    }
20    /// <p>The current version (<code>ETag</code> value) of the function that you are testing, which you can get using <code>DescribeFunction</code>.</p>
21    pub fn if_match(&self) -> ::std::option::Option<&str> {
22        self.if_match.as_deref()
23    }
24    /// <p>The stage of the function that you are testing, either <code>DEVELOPMENT</code> or <code>LIVE</code>.</p>
25    pub fn stage(&self) -> ::std::option::Option<&crate::types::FunctionStage> {
26        self.stage.as_ref()
27    }
28    /// <p>The event object to test the function with. For more information about the structure of the event object, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/managing-functions.html#test-function">Testing functions</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
29    pub fn event_object(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
30        self.event_object.as_ref()
31    }
32}
33impl ::std::fmt::Debug for TestFunctionInput {
34    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
35        let mut formatter = f.debug_struct("TestFunctionInput");
36        formatter.field("name", &self.name);
37        formatter.field("if_match", &self.if_match);
38        formatter.field("stage", &self.stage);
39        formatter.field("event_object", &"*** Sensitive Data Redacted ***");
40        formatter.finish()
41    }
42}
43impl TestFunctionInput {
44    /// Creates a new builder-style object to manufacture [`TestFunctionInput`](crate::operation::test_function::TestFunctionInput).
45    pub fn builder() -> crate::operation::test_function::builders::TestFunctionInputBuilder {
46        crate::operation::test_function::builders::TestFunctionInputBuilder::default()
47    }
48}
49
50/// A builder for [`TestFunctionInput`](crate::operation::test_function::TestFunctionInput).
51#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
52#[non_exhaustive]
53pub struct TestFunctionInputBuilder {
54    pub(crate) name: ::std::option::Option<::std::string::String>,
55    pub(crate) if_match: ::std::option::Option<::std::string::String>,
56    pub(crate) stage: ::std::option::Option<crate::types::FunctionStage>,
57    pub(crate) event_object: ::std::option::Option<::aws_smithy_types::Blob>,
58}
59impl TestFunctionInputBuilder {
60    /// <p>The name of the function that you are testing.</p>
61    /// This field is required.
62    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
63        self.name = ::std::option::Option::Some(input.into());
64        self
65    }
66    /// <p>The name of the function that you are testing.</p>
67    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
68        self.name = input;
69        self
70    }
71    /// <p>The name of the function that you are testing.</p>
72    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
73        &self.name
74    }
75    /// <p>The current version (<code>ETag</code> value) of the function that you are testing, which you can get using <code>DescribeFunction</code>.</p>
76    /// This field is required.
77    pub fn if_match(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
78        self.if_match = ::std::option::Option::Some(input.into());
79        self
80    }
81    /// <p>The current version (<code>ETag</code> value) of the function that you are testing, which you can get using <code>DescribeFunction</code>.</p>
82    pub fn set_if_match(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
83        self.if_match = input;
84        self
85    }
86    /// <p>The current version (<code>ETag</code> value) of the function that you are testing, which you can get using <code>DescribeFunction</code>.</p>
87    pub fn get_if_match(&self) -> &::std::option::Option<::std::string::String> {
88        &self.if_match
89    }
90    /// <p>The stage of the function that you are testing, either <code>DEVELOPMENT</code> or <code>LIVE</code>.</p>
91    pub fn stage(mut self, input: crate::types::FunctionStage) -> Self {
92        self.stage = ::std::option::Option::Some(input);
93        self
94    }
95    /// <p>The stage of the function that you are testing, either <code>DEVELOPMENT</code> or <code>LIVE</code>.</p>
96    pub fn set_stage(mut self, input: ::std::option::Option<crate::types::FunctionStage>) -> Self {
97        self.stage = input;
98        self
99    }
100    /// <p>The stage of the function that you are testing, either <code>DEVELOPMENT</code> or <code>LIVE</code>.</p>
101    pub fn get_stage(&self) -> &::std::option::Option<crate::types::FunctionStage> {
102        &self.stage
103    }
104    /// <p>The event object to test the function with. For more information about the structure of the event object, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/managing-functions.html#test-function">Testing functions</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
105    /// This field is required.
106    pub fn event_object(mut self, input: ::aws_smithy_types::Blob) -> Self {
107        self.event_object = ::std::option::Option::Some(input);
108        self
109    }
110    /// <p>The event object to test the function with. For more information about the structure of the event object, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/managing-functions.html#test-function">Testing functions</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
111    pub fn set_event_object(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
112        self.event_object = input;
113        self
114    }
115    /// <p>The event object to test the function with. For more information about the structure of the event object, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/managing-functions.html#test-function">Testing functions</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
116    pub fn get_event_object(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
117        &self.event_object
118    }
119    /// Consumes the builder and constructs a [`TestFunctionInput`](crate::operation::test_function::TestFunctionInput).
120    pub fn build(
121        self,
122    ) -> ::std::result::Result<crate::operation::test_function::TestFunctionInput, ::aws_smithy_types::error::operation::BuildError> {
123        ::std::result::Result::Ok(crate::operation::test_function::TestFunctionInput {
124            name: self.name,
125            if_match: self.if_match,
126            stage: self.stage,
127            event_object: self.event_object,
128        })
129    }
130}
131impl ::std::fmt::Debug for TestFunctionInputBuilder {
132    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
133        let mut formatter = f.debug_struct("TestFunctionInputBuilder");
134        formatter.field("name", &self.name);
135        formatter.field("if_match", &self.if_match);
136        formatter.field("stage", &self.stage);
137        formatter.field("event_object", &"*** Sensitive Data Redacted ***");
138        formatter.finish()
139    }
140}