aws_sdk_codestar/operation/create_project/
_create_project_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 CreateProjectInput {
6    /// <p>The display name for the project to be created in AWS CodeStar.</p>
7    pub name: ::std::option::Option<::std::string::String>,
8    /// <p>The ID of the project to be created in AWS CodeStar.</p>
9    pub id: ::std::option::Option<::std::string::String>,
10    /// <p>The description of the project, if any.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>A user- or system-generated token that identifies the entity that requested project creation. This token can be used to repeat the request.</p>
13    pub client_request_token: ::std::option::Option<::std::string::String>,
14    /// <p>A list of the Code objects submitted with the project request. If this parameter is specified, the request must also include the toolchain parameter.</p>
15    pub source_code: ::std::option::Option<::std::vec::Vec<crate::types::Code>>,
16    /// <p>The name of the toolchain template file submitted with the project request. If this parameter is specified, the request must also include the sourceCode parameter.</p>
17    pub toolchain: ::std::option::Option<crate::types::Toolchain>,
18    /// <p>The tags created for the project.</p>
19    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
20}
21impl CreateProjectInput {
22    /// <p>The display name for the project to be created in AWS CodeStar.</p>
23    pub fn name(&self) -> ::std::option::Option<&str> {
24        self.name.as_deref()
25    }
26    /// <p>The ID of the project to be created in AWS CodeStar.</p>
27    pub fn id(&self) -> ::std::option::Option<&str> {
28        self.id.as_deref()
29    }
30    /// <p>The description of the project, if any.</p>
31    pub fn description(&self) -> ::std::option::Option<&str> {
32        self.description.as_deref()
33    }
34    /// <p>A user- or system-generated token that identifies the entity that requested project creation. This token can be used to repeat the request.</p>
35    pub fn client_request_token(&self) -> ::std::option::Option<&str> {
36        self.client_request_token.as_deref()
37    }
38    /// <p>A list of the Code objects submitted with the project request. If this parameter is specified, the request must also include the toolchain parameter.</p>
39    ///
40    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.source_code.is_none()`.
41    pub fn source_code(&self) -> &[crate::types::Code] {
42        self.source_code.as_deref().unwrap_or_default()
43    }
44    /// <p>The name of the toolchain template file submitted with the project request. If this parameter is specified, the request must also include the sourceCode parameter.</p>
45    pub fn toolchain(&self) -> ::std::option::Option<&crate::types::Toolchain> {
46        self.toolchain.as_ref()
47    }
48    /// <p>The tags created for the project.</p>
49    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
50        self.tags.as_ref()
51    }
52}
53impl ::std::fmt::Debug for CreateProjectInput {
54    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
55        let mut formatter = f.debug_struct("CreateProjectInput");
56        formatter.field("name", &"*** Sensitive Data Redacted ***");
57        formatter.field("id", &self.id);
58        formatter.field("description", &"*** Sensitive Data Redacted ***");
59        formatter.field("client_request_token", &self.client_request_token);
60        formatter.field("source_code", &self.source_code);
61        formatter.field("toolchain", &self.toolchain);
62        formatter.field("tags", &self.tags);
63        formatter.finish()
64    }
65}
66impl CreateProjectInput {
67    /// Creates a new builder-style object to manufacture [`CreateProjectInput`](crate::operation::create_project::CreateProjectInput).
68    pub fn builder() -> crate::operation::create_project::builders::CreateProjectInputBuilder {
69        crate::operation::create_project::builders::CreateProjectInputBuilder::default()
70    }
71}
72
73/// A builder for [`CreateProjectInput`](crate::operation::create_project::CreateProjectInput).
74#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
75#[non_exhaustive]
76pub struct CreateProjectInputBuilder {
77    pub(crate) name: ::std::option::Option<::std::string::String>,
78    pub(crate) id: ::std::option::Option<::std::string::String>,
79    pub(crate) description: ::std::option::Option<::std::string::String>,
80    pub(crate) client_request_token: ::std::option::Option<::std::string::String>,
81    pub(crate) source_code: ::std::option::Option<::std::vec::Vec<crate::types::Code>>,
82    pub(crate) toolchain: ::std::option::Option<crate::types::Toolchain>,
83    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
84}
85impl CreateProjectInputBuilder {
86    /// <p>The display name for the project to be created in AWS CodeStar.</p>
87    /// This field is required.
88    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
89        self.name = ::std::option::Option::Some(input.into());
90        self
91    }
92    /// <p>The display name for the project to be created in AWS CodeStar.</p>
93    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
94        self.name = input;
95        self
96    }
97    /// <p>The display name for the project to be created in AWS CodeStar.</p>
98    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
99        &self.name
100    }
101    /// <p>The ID of the project to be created in AWS CodeStar.</p>
102    /// This field is required.
103    pub fn id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
104        self.id = ::std::option::Option::Some(input.into());
105        self
106    }
107    /// <p>The ID of the project to be created in AWS CodeStar.</p>
108    pub fn set_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
109        self.id = input;
110        self
111    }
112    /// <p>The ID of the project to be created in AWS CodeStar.</p>
113    pub fn get_id(&self) -> &::std::option::Option<::std::string::String> {
114        &self.id
115    }
116    /// <p>The description of the project, if any.</p>
117    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
118        self.description = ::std::option::Option::Some(input.into());
119        self
120    }
121    /// <p>The description of the project, if any.</p>
122    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
123        self.description = input;
124        self
125    }
126    /// <p>The description of the project, if any.</p>
127    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
128        &self.description
129    }
130    /// <p>A user- or system-generated token that identifies the entity that requested project creation. This token can be used to repeat the request.</p>
131    pub fn client_request_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
132        self.client_request_token = ::std::option::Option::Some(input.into());
133        self
134    }
135    /// <p>A user- or system-generated token that identifies the entity that requested project creation. This token can be used to repeat the request.</p>
136    pub fn set_client_request_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
137        self.client_request_token = input;
138        self
139    }
140    /// <p>A user- or system-generated token that identifies the entity that requested project creation. This token can be used to repeat the request.</p>
141    pub fn get_client_request_token(&self) -> &::std::option::Option<::std::string::String> {
142        &self.client_request_token
143    }
144    /// Appends an item to `source_code`.
145    ///
146    /// To override the contents of this collection use [`set_source_code`](Self::set_source_code).
147    ///
148    /// <p>A list of the Code objects submitted with the project request. If this parameter is specified, the request must also include the toolchain parameter.</p>
149    pub fn source_code(mut self, input: crate::types::Code) -> Self {
150        let mut v = self.source_code.unwrap_or_default();
151        v.push(input);
152        self.source_code = ::std::option::Option::Some(v);
153        self
154    }
155    /// <p>A list of the Code objects submitted with the project request. If this parameter is specified, the request must also include the toolchain parameter.</p>
156    pub fn set_source_code(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Code>>) -> Self {
157        self.source_code = input;
158        self
159    }
160    /// <p>A list of the Code objects submitted with the project request. If this parameter is specified, the request must also include the toolchain parameter.</p>
161    pub fn get_source_code(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Code>> {
162        &self.source_code
163    }
164    /// <p>The name of the toolchain template file submitted with the project request. If this parameter is specified, the request must also include the sourceCode parameter.</p>
165    pub fn toolchain(mut self, input: crate::types::Toolchain) -> Self {
166        self.toolchain = ::std::option::Option::Some(input);
167        self
168    }
169    /// <p>The name of the toolchain template file submitted with the project request. If this parameter is specified, the request must also include the sourceCode parameter.</p>
170    pub fn set_toolchain(mut self, input: ::std::option::Option<crate::types::Toolchain>) -> Self {
171        self.toolchain = input;
172        self
173    }
174    /// <p>The name of the toolchain template file submitted with the project request. If this parameter is specified, the request must also include the sourceCode parameter.</p>
175    pub fn get_toolchain(&self) -> &::std::option::Option<crate::types::Toolchain> {
176        &self.toolchain
177    }
178    /// Adds a key-value pair to `tags`.
179    ///
180    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
181    ///
182    /// <p>The tags created for the project.</p>
183    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
184        let mut hash_map = self.tags.unwrap_or_default();
185        hash_map.insert(k.into(), v.into());
186        self.tags = ::std::option::Option::Some(hash_map);
187        self
188    }
189    /// <p>The tags created for the project.</p>
190    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
191        self.tags = input;
192        self
193    }
194    /// <p>The tags created for the project.</p>
195    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
196        &self.tags
197    }
198    /// Consumes the builder and constructs a [`CreateProjectInput`](crate::operation::create_project::CreateProjectInput).
199    pub fn build(
200        self,
201    ) -> ::std::result::Result<crate::operation::create_project::CreateProjectInput, ::aws_smithy_types::error::operation::BuildError> {
202        ::std::result::Result::Ok(crate::operation::create_project::CreateProjectInput {
203            name: self.name,
204            id: self.id,
205            description: self.description,
206            client_request_token: self.client_request_token,
207            source_code: self.source_code,
208            toolchain: self.toolchain,
209            tags: self.tags,
210        })
211    }
212}
213impl ::std::fmt::Debug for CreateProjectInputBuilder {
214    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
215        let mut formatter = f.debug_struct("CreateProjectInputBuilder");
216        formatter.field("name", &"*** Sensitive Data Redacted ***");
217        formatter.field("id", &self.id);
218        formatter.field("description", &"*** Sensitive Data Redacted ***");
219        formatter.field("client_request_token", &self.client_request_token);
220        formatter.field("source_code", &self.source_code);
221        formatter.field("toolchain", &self.toolchain);
222        formatter.field("tags", &self.tags);
223        formatter.finish()
224    }
225}