Skip to main content

aws_sdk_cloudfront/operation/create_function/
_create_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 CreateFunctionInput {
6    /// <p>A name to identify the function.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>Configuration information about the function, including an optional comment and the function's runtime.</p>
9    pub function_config: ::std::option::Option<crate::types::FunctionConfig>,
10    /// <p>The function code. For more information about writing a CloudFront function, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/writing-function-code.html">Writing function code for CloudFront Functions</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
11    pub function_code: ::std::option::Option<::aws_smithy_types::Blob>,
12    /// <p>A complex type that contains zero or more <code>Tag</code> elements.</p>
13    pub tags: ::std::option::Option<crate::types::Tags>,
14}
15impl CreateFunctionInput {
16    /// <p>A name to identify the function.</p>
17    pub fn name(&self) -> ::std::option::Option<&str> {
18        self.name.as_deref()
19    }
20    /// <p>Configuration information about the function, including an optional comment and the function's runtime.</p>
21    pub fn function_config(&self) -> ::std::option::Option<&crate::types::FunctionConfig> {
22        self.function_config.as_ref()
23    }
24    /// <p>The function code. For more information about writing a CloudFront function, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/writing-function-code.html">Writing function code for CloudFront Functions</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
25    pub fn function_code(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
26        self.function_code.as_ref()
27    }
28    /// <p>A complex type that contains zero or more <code>Tag</code> elements.</p>
29    pub fn tags(&self) -> ::std::option::Option<&crate::types::Tags> {
30        self.tags.as_ref()
31    }
32}
33impl ::std::fmt::Debug for CreateFunctionInput {
34    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
35        let mut formatter = f.debug_struct("CreateFunctionInput");
36        formatter.field("name", &self.name);
37        formatter.field("function_config", &self.function_config);
38        formatter.field("function_code", &"*** Sensitive Data Redacted ***");
39        formatter.field("tags", &self.tags);
40        formatter.finish()
41    }
42}
43impl CreateFunctionInput {
44    /// Creates a new builder-style object to manufacture [`CreateFunctionInput`](crate::operation::create_function::CreateFunctionInput).
45    pub fn builder() -> crate::operation::create_function::builders::CreateFunctionInputBuilder {
46        crate::operation::create_function::builders::CreateFunctionInputBuilder::default()
47    }
48}
49
50/// A builder for [`CreateFunctionInput`](crate::operation::create_function::CreateFunctionInput).
51#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
52#[non_exhaustive]
53pub struct CreateFunctionInputBuilder {
54    pub(crate) name: ::std::option::Option<::std::string::String>,
55    pub(crate) function_config: ::std::option::Option<crate::types::FunctionConfig>,
56    pub(crate) function_code: ::std::option::Option<::aws_smithy_types::Blob>,
57    pub(crate) tags: ::std::option::Option<crate::types::Tags>,
58}
59impl CreateFunctionInputBuilder {
60    /// <p>A name to identify the function.</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>A name to identify the function.</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>A name to identify the function.</p>
72    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
73        &self.name
74    }
75    /// <p>Configuration information about the function, including an optional comment and the function's runtime.</p>
76    /// This field is required.
77    pub fn function_config(mut self, input: crate::types::FunctionConfig) -> Self {
78        self.function_config = ::std::option::Option::Some(input);
79        self
80    }
81    /// <p>Configuration information about the function, including an optional comment and the function's runtime.</p>
82    pub fn set_function_config(mut self, input: ::std::option::Option<crate::types::FunctionConfig>) -> Self {
83        self.function_config = input;
84        self
85    }
86    /// <p>Configuration information about the function, including an optional comment and the function's runtime.</p>
87    pub fn get_function_config(&self) -> &::std::option::Option<crate::types::FunctionConfig> {
88        &self.function_config
89    }
90    /// <p>The function code. For more information about writing a CloudFront function, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/writing-function-code.html">Writing function code for CloudFront Functions</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
91    /// This field is required.
92    pub fn function_code(mut self, input: ::aws_smithy_types::Blob) -> Self {
93        self.function_code = ::std::option::Option::Some(input);
94        self
95    }
96    /// <p>The function code. For more information about writing a CloudFront function, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/writing-function-code.html">Writing function code for CloudFront Functions</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
97    pub fn set_function_code(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
98        self.function_code = input;
99        self
100    }
101    /// <p>The function code. For more information about writing a CloudFront function, see <a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/writing-function-code.html">Writing function code for CloudFront Functions</a> in the <i>Amazon CloudFront Developer Guide</i>.</p>
102    pub fn get_function_code(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
103        &self.function_code
104    }
105    /// <p>A complex type that contains zero or more <code>Tag</code> elements.</p>
106    pub fn tags(mut self, input: crate::types::Tags) -> Self {
107        self.tags = ::std::option::Option::Some(input);
108        self
109    }
110    /// <p>A complex type that contains zero or more <code>Tag</code> elements.</p>
111    pub fn set_tags(mut self, input: ::std::option::Option<crate::types::Tags>) -> Self {
112        self.tags = input;
113        self
114    }
115    /// <p>A complex type that contains zero or more <code>Tag</code> elements.</p>
116    pub fn get_tags(&self) -> &::std::option::Option<crate::types::Tags> {
117        &self.tags
118    }
119    /// Consumes the builder and constructs a [`CreateFunctionInput`](crate::operation::create_function::CreateFunctionInput).
120    pub fn build(
121        self,
122    ) -> ::std::result::Result<crate::operation::create_function::CreateFunctionInput, ::aws_smithy_types::error::operation::BuildError> {
123        ::std::result::Result::Ok(crate::operation::create_function::CreateFunctionInput {
124            name: self.name,
125            function_config: self.function_config,
126            function_code: self.function_code,
127            tags: self.tags,
128        })
129    }
130}
131impl ::std::fmt::Debug for CreateFunctionInputBuilder {
132    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
133        let mut formatter = f.debug_struct("CreateFunctionInputBuilder");
134        formatter.field("name", &self.name);
135        formatter.field("function_config", &self.function_config);
136        formatter.field("function_code", &"*** Sensitive Data Redacted ***");
137        formatter.field("tags", &self.tags);
138        formatter.finish()
139    }
140}