aws_sdk_iotanalytics/operation/create_channel/
_create_channel_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, ::std::fmt::Debug)]
5pub struct CreateChannelInput {
6    /// <p>The name of the channel.</p>
7    pub channel_name: ::std::option::Option<::std::string::String>,
8    /// <p>Where channel data is stored. You can choose one of <code>serviceManagedS3</code> or <code>customerManagedS3</code> storage. If not specified, the default is <code>serviceManagedS3</code>. You can't change this storage option after the channel is created.</p>
9    pub channel_storage: ::std::option::Option<crate::types::ChannelStorage>,
10    /// <p>How long, in days, message data is kept for the channel. When <code>customerManagedS3</code> storage is selected, this parameter is ignored.</p>
11    pub retention_period: ::std::option::Option<crate::types::RetentionPeriod>,
12    /// <p>Metadata which can be used to manage the channel.</p>
13    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
14}
15impl CreateChannelInput {
16    /// <p>The name of the channel.</p>
17    pub fn channel_name(&self) -> ::std::option::Option<&str> {
18        self.channel_name.as_deref()
19    }
20    /// <p>Where channel data is stored. You can choose one of <code>serviceManagedS3</code> or <code>customerManagedS3</code> storage. If not specified, the default is <code>serviceManagedS3</code>. You can't change this storage option after the channel is created.</p>
21    pub fn channel_storage(&self) -> ::std::option::Option<&crate::types::ChannelStorage> {
22        self.channel_storage.as_ref()
23    }
24    /// <p>How long, in days, message data is kept for the channel. When <code>customerManagedS3</code> storage is selected, this parameter is ignored.</p>
25    pub fn retention_period(&self) -> ::std::option::Option<&crate::types::RetentionPeriod> {
26        self.retention_period.as_ref()
27    }
28    /// <p>Metadata which can be used to manage the channel.</p>
29    ///
30    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
31    pub fn tags(&self) -> &[crate::types::Tag] {
32        self.tags.as_deref().unwrap_or_default()
33    }
34}
35impl CreateChannelInput {
36    /// Creates a new builder-style object to manufacture [`CreateChannelInput`](crate::operation::create_channel::CreateChannelInput).
37    pub fn builder() -> crate::operation::create_channel::builders::CreateChannelInputBuilder {
38        crate::operation::create_channel::builders::CreateChannelInputBuilder::default()
39    }
40}
41
42/// A builder for [`CreateChannelInput`](crate::operation::create_channel::CreateChannelInput).
43#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
44#[non_exhaustive]
45pub struct CreateChannelInputBuilder {
46    pub(crate) channel_name: ::std::option::Option<::std::string::String>,
47    pub(crate) channel_storage: ::std::option::Option<crate::types::ChannelStorage>,
48    pub(crate) retention_period: ::std::option::Option<crate::types::RetentionPeriod>,
49    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
50}
51impl CreateChannelInputBuilder {
52    /// <p>The name of the channel.</p>
53    /// This field is required.
54    pub fn channel_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55        self.channel_name = ::std::option::Option::Some(input.into());
56        self
57    }
58    /// <p>The name of the channel.</p>
59    pub fn set_channel_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60        self.channel_name = input;
61        self
62    }
63    /// <p>The name of the channel.</p>
64    pub fn get_channel_name(&self) -> &::std::option::Option<::std::string::String> {
65        &self.channel_name
66    }
67    /// <p>Where channel data is stored. You can choose one of <code>serviceManagedS3</code> or <code>customerManagedS3</code> storage. If not specified, the default is <code>serviceManagedS3</code>. You can't change this storage option after the channel is created.</p>
68    pub fn channel_storage(mut self, input: crate::types::ChannelStorage) -> Self {
69        self.channel_storage = ::std::option::Option::Some(input);
70        self
71    }
72    /// <p>Where channel data is stored. You can choose one of <code>serviceManagedS3</code> or <code>customerManagedS3</code> storage. If not specified, the default is <code>serviceManagedS3</code>. You can't change this storage option after the channel is created.</p>
73    pub fn set_channel_storage(mut self, input: ::std::option::Option<crate::types::ChannelStorage>) -> Self {
74        self.channel_storage = input;
75        self
76    }
77    /// <p>Where channel data is stored. You can choose one of <code>serviceManagedS3</code> or <code>customerManagedS3</code> storage. If not specified, the default is <code>serviceManagedS3</code>. You can't change this storage option after the channel is created.</p>
78    pub fn get_channel_storage(&self) -> &::std::option::Option<crate::types::ChannelStorage> {
79        &self.channel_storage
80    }
81    /// <p>How long, in days, message data is kept for the channel. When <code>customerManagedS3</code> storage is selected, this parameter is ignored.</p>
82    pub fn retention_period(mut self, input: crate::types::RetentionPeriod) -> Self {
83        self.retention_period = ::std::option::Option::Some(input);
84        self
85    }
86    /// <p>How long, in days, message data is kept for the channel. When <code>customerManagedS3</code> storage is selected, this parameter is ignored.</p>
87    pub fn set_retention_period(mut self, input: ::std::option::Option<crate::types::RetentionPeriod>) -> Self {
88        self.retention_period = input;
89        self
90    }
91    /// <p>How long, in days, message data is kept for the channel. When <code>customerManagedS3</code> storage is selected, this parameter is ignored.</p>
92    pub fn get_retention_period(&self) -> &::std::option::Option<crate::types::RetentionPeriod> {
93        &self.retention_period
94    }
95    /// Appends an item to `tags`.
96    ///
97    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
98    ///
99    /// <p>Metadata which can be used to manage the channel.</p>
100    pub fn tags(mut self, input: crate::types::Tag) -> Self {
101        let mut v = self.tags.unwrap_or_default();
102        v.push(input);
103        self.tags = ::std::option::Option::Some(v);
104        self
105    }
106    /// <p>Metadata which can be used to manage the channel.</p>
107    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
108        self.tags = input;
109        self
110    }
111    /// <p>Metadata which can be used to manage the channel.</p>
112    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
113        &self.tags
114    }
115    /// Consumes the builder and constructs a [`CreateChannelInput`](crate::operation::create_channel::CreateChannelInput).
116    pub fn build(
117        self,
118    ) -> ::std::result::Result<crate::operation::create_channel::CreateChannelInput, ::aws_smithy_types::error::operation::BuildError> {
119        ::std::result::Result::Ok(crate::operation::create_channel::CreateChannelInput {
120            channel_name: self.channel_name,
121            channel_storage: self.channel_storage,
122            retention_period: self.retention_period,
123            tags: self.tags,
124        })
125    }
126}