Skip to main content

aws_sdk_kafka/operation/create_topic/
_create_topic_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 CreateTopicInput {
6    /// <p>The Amazon Resource Name (ARN) that uniquely identifies the cluster.</p>
7    pub cluster_arn: ::std::option::Option<::std::string::String>,
8    /// <p>The name of the topic to create.</p>
9    pub topic_name: ::std::option::Option<::std::string::String>,
10    /// <p>The number of partitions for the topic.</p>
11    pub partition_count: ::std::option::Option<i32>,
12    /// <p>The replication factor for the topic.</p>
13    pub replication_factor: ::std::option::Option<i32>,
14    /// <p>Topic configurations encoded as a Base64 string.</p>
15    pub configs: ::std::option::Option<::std::string::String>,
16}
17impl CreateTopicInput {
18    /// <p>The Amazon Resource Name (ARN) that uniquely identifies the cluster.</p>
19    pub fn cluster_arn(&self) -> ::std::option::Option<&str> {
20        self.cluster_arn.as_deref()
21    }
22    /// <p>The name of the topic to create.</p>
23    pub fn topic_name(&self) -> ::std::option::Option<&str> {
24        self.topic_name.as_deref()
25    }
26    /// <p>The number of partitions for the topic.</p>
27    pub fn partition_count(&self) -> ::std::option::Option<i32> {
28        self.partition_count
29    }
30    /// <p>The replication factor for the topic.</p>
31    pub fn replication_factor(&self) -> ::std::option::Option<i32> {
32        self.replication_factor
33    }
34    /// <p>Topic configurations encoded as a Base64 string.</p>
35    pub fn configs(&self) -> ::std::option::Option<&str> {
36        self.configs.as_deref()
37    }
38}
39impl CreateTopicInput {
40    /// Creates a new builder-style object to manufacture [`CreateTopicInput`](crate::operation::create_topic::CreateTopicInput).
41    pub fn builder() -> crate::operation::create_topic::builders::CreateTopicInputBuilder {
42        crate::operation::create_topic::builders::CreateTopicInputBuilder::default()
43    }
44}
45
46/// A builder for [`CreateTopicInput`](crate::operation::create_topic::CreateTopicInput).
47#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
48#[non_exhaustive]
49pub struct CreateTopicInputBuilder {
50    pub(crate) cluster_arn: ::std::option::Option<::std::string::String>,
51    pub(crate) topic_name: ::std::option::Option<::std::string::String>,
52    pub(crate) partition_count: ::std::option::Option<i32>,
53    pub(crate) replication_factor: ::std::option::Option<i32>,
54    pub(crate) configs: ::std::option::Option<::std::string::String>,
55}
56impl CreateTopicInputBuilder {
57    /// <p>The Amazon Resource Name (ARN) that uniquely identifies the cluster.</p>
58    /// This field is required.
59    pub fn cluster_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
60        self.cluster_arn = ::std::option::Option::Some(input.into());
61        self
62    }
63    /// <p>The Amazon Resource Name (ARN) that uniquely identifies the cluster.</p>
64    pub fn set_cluster_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
65        self.cluster_arn = input;
66        self
67    }
68    /// <p>The Amazon Resource Name (ARN) that uniquely identifies the cluster.</p>
69    pub fn get_cluster_arn(&self) -> &::std::option::Option<::std::string::String> {
70        &self.cluster_arn
71    }
72    /// <p>The name of the topic to create.</p>
73    /// This field is required.
74    pub fn topic_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
75        self.topic_name = ::std::option::Option::Some(input.into());
76        self
77    }
78    /// <p>The name of the topic to create.</p>
79    pub fn set_topic_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
80        self.topic_name = input;
81        self
82    }
83    /// <p>The name of the topic to create.</p>
84    pub fn get_topic_name(&self) -> &::std::option::Option<::std::string::String> {
85        &self.topic_name
86    }
87    /// <p>The number of partitions for the topic.</p>
88    /// This field is required.
89    pub fn partition_count(mut self, input: i32) -> Self {
90        self.partition_count = ::std::option::Option::Some(input);
91        self
92    }
93    /// <p>The number of partitions for the topic.</p>
94    pub fn set_partition_count(mut self, input: ::std::option::Option<i32>) -> Self {
95        self.partition_count = input;
96        self
97    }
98    /// <p>The number of partitions for the topic.</p>
99    pub fn get_partition_count(&self) -> &::std::option::Option<i32> {
100        &self.partition_count
101    }
102    /// <p>The replication factor for the topic.</p>
103    /// This field is required.
104    pub fn replication_factor(mut self, input: i32) -> Self {
105        self.replication_factor = ::std::option::Option::Some(input);
106        self
107    }
108    /// <p>The replication factor for the topic.</p>
109    pub fn set_replication_factor(mut self, input: ::std::option::Option<i32>) -> Self {
110        self.replication_factor = input;
111        self
112    }
113    /// <p>The replication factor for the topic.</p>
114    pub fn get_replication_factor(&self) -> &::std::option::Option<i32> {
115        &self.replication_factor
116    }
117    /// <p>Topic configurations encoded as a Base64 string.</p>
118    pub fn configs(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
119        self.configs = ::std::option::Option::Some(input.into());
120        self
121    }
122    /// <p>Topic configurations encoded as a Base64 string.</p>
123    pub fn set_configs(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
124        self.configs = input;
125        self
126    }
127    /// <p>Topic configurations encoded as a Base64 string.</p>
128    pub fn get_configs(&self) -> &::std::option::Option<::std::string::String> {
129        &self.configs
130    }
131    /// Consumes the builder and constructs a [`CreateTopicInput`](crate::operation::create_topic::CreateTopicInput).
132    pub fn build(self) -> ::std::result::Result<crate::operation::create_topic::CreateTopicInput, ::aws_smithy_types::error::operation::BuildError> {
133        ::std::result::Result::Ok(crate::operation::create_topic::CreateTopicInput {
134            cluster_arn: self.cluster_arn,
135            topic_name: self.topic_name,
136            partition_count: self.partition_count,
137            replication_factor: self.replication_factor,
138            configs: self.configs,
139        })
140    }
141}