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}
13impl CreateFunctionInput {
14    /// <p>A name to identify the function.</p>
15    pub fn name(&self) -> ::std::option::Option<&str> {
16        self.name.as_deref()
17    }
18    /// <p>Configuration information about the function, including an optional comment and the function's runtime.</p>
19    pub fn function_config(&self) -> ::std::option::Option<&crate::types::FunctionConfig> {
20        self.function_config.as_ref()
21    }
22    /// <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>
23    pub fn function_code(&self) -> ::std::option::Option<&::aws_smithy_types::Blob> {
24        self.function_code.as_ref()
25    }
26}
27impl ::std::fmt::Debug for CreateFunctionInput {
28    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
29        let mut formatter = f.debug_struct("CreateFunctionInput");
30        formatter.field("name", &self.name);
31        formatter.field("function_config", &self.function_config);
32        formatter.field("function_code", &"*** Sensitive Data Redacted ***");
33        formatter.finish()
34    }
35}
36impl CreateFunctionInput {
37    /// Creates a new builder-style object to manufacture [`CreateFunctionInput`](crate::operation::create_function::CreateFunctionInput).
38    pub fn builder() -> crate::operation::create_function::builders::CreateFunctionInputBuilder {
39        crate::operation::create_function::builders::CreateFunctionInputBuilder::default()
40    }
41}
42
43/// A builder for [`CreateFunctionInput`](crate::operation::create_function::CreateFunctionInput).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
45#[non_exhaustive]
46pub struct CreateFunctionInputBuilder {
47    pub(crate) name: ::std::option::Option<::std::string::String>,
48    pub(crate) function_config: ::std::option::Option<crate::types::FunctionConfig>,
49    pub(crate) function_code: ::std::option::Option<::aws_smithy_types::Blob>,
50}
51impl CreateFunctionInputBuilder {
52    /// <p>A name to identify the function.</p>
53    /// This field is required.
54    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55        self.name = ::std::option::Option::Some(input.into());
56        self
57    }
58    /// <p>A name to identify the function.</p>
59    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60        self.name = input;
61        self
62    }
63    /// <p>A name to identify the function.</p>
64    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
65        &self.name
66    }
67    /// <p>Configuration information about the function, including an optional comment and the function's runtime.</p>
68    /// This field is required.
69    pub fn function_config(mut self, input: crate::types::FunctionConfig) -> Self {
70        self.function_config = ::std::option::Option::Some(input);
71        self
72    }
73    /// <p>Configuration information about the function, including an optional comment and the function's runtime.</p>
74    pub fn set_function_config(mut self, input: ::std::option::Option<crate::types::FunctionConfig>) -> Self {
75        self.function_config = input;
76        self
77    }
78    /// <p>Configuration information about the function, including an optional comment and the function's runtime.</p>
79    pub fn get_function_config(&self) -> &::std::option::Option<crate::types::FunctionConfig> {
80        &self.function_config
81    }
82    /// <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>
83    /// This field is required.
84    pub fn function_code(mut self, input: ::aws_smithy_types::Blob) -> Self {
85        self.function_code = ::std::option::Option::Some(input);
86        self
87    }
88    /// <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>
89    pub fn set_function_code(mut self, input: ::std::option::Option<::aws_smithy_types::Blob>) -> Self {
90        self.function_code = input;
91        self
92    }
93    /// <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>
94    pub fn get_function_code(&self) -> &::std::option::Option<::aws_smithy_types::Blob> {
95        &self.function_code
96    }
97    /// Consumes the builder and constructs a [`CreateFunctionInput`](crate::operation::create_function::CreateFunctionInput).
98    pub fn build(
99        self,
100    ) -> ::std::result::Result<crate::operation::create_function::CreateFunctionInput, ::aws_smithy_types::error::operation::BuildError> {
101        ::std::result::Result::Ok(crate::operation::create_function::CreateFunctionInput {
102            name: self.name,
103            function_config: self.function_config,
104            function_code: self.function_code,
105        })
106    }
107}
108impl ::std::fmt::Debug for CreateFunctionInputBuilder {
109    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
110        let mut formatter = f.debug_struct("CreateFunctionInputBuilder");
111        formatter.field("name", &self.name);
112        formatter.field("function_config", &self.function_config);
113        formatter.field("function_code", &"*** Sensitive Data Redacted ***");
114        formatter.finish()
115    }
116}