Skip to main content

aws_sdk_securityagent/operation/create_threat/
_create_threat_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Input for creating a new threat.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateThreatInput {
7    /// <p>The unique identifier of the agent space.</p>
8    pub agent_space_id: ::std::option::Option<::std::string::String>,
9    /// <p>The unique identifier of the threat model job the threat belongs to.</p>
10    pub threat_job_id: ::std::option::Option<::std::string::String>,
11    /// <p>A short title summarizing the threat.</p>
12    pub title: ::std::option::Option<::std::string::String>,
13    /// <p>The natural-language threat statement.</p>
14    pub statement: ::std::option::Option<::std::string::String>,
15    /// <p>The severity level of the threat.</p>
16    pub severity: ::std::option::Option<crate::types::ThreatSeverity>,
17    /// <p>Optional customer comment on the threat.</p>
18    pub comments: ::std::option::Option<::std::string::String>,
19    /// <p>The STRIDE categories applicable to this threat.</p>
20    pub stride: ::std::option::Option<::std::vec::Vec<crate::types::StrideCategory>>,
21    /// <p>The actor or origin of the threat.</p>
22    pub threat_source: ::std::option::Option<::std::string::String>,
23    /// <p>The conditions required for the threat to be exploitable.</p>
24    pub prerequisites: ::std::option::Option<::std::string::String>,
25    /// <p>What the threat source can do.</p>
26    pub threat_action: ::std::option::Option<::std::string::String>,
27    /// <p>The direct consequence of the threat action.</p>
28    pub threat_impact: ::std::option::Option<::std::string::String>,
29    /// <p>The security goals affected by the threat.</p>
30    pub impacted_goal: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
31    /// <p>The specific assets affected by the threat.</p>
32    pub impacted_assets: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
33    /// <p>The DFD element this threat is anchored to.</p>
34    pub anchor: ::std::option::Option<crate::types::ThreatAnchorShape>,
35    /// <p>The source code files supporting the threat.</p>
36    pub evidence: ::std::option::Option<::std::vec::Vec<crate::types::ThreatEvidenceShape>>,
37    /// <p>The recommended mitigation guidance for this threat.</p>
38    pub recommendation: ::std::option::Option<::std::string::String>,
39}
40impl CreateThreatInput {
41    /// <p>The unique identifier of the agent space.</p>
42    pub fn agent_space_id(&self) -> ::std::option::Option<&str> {
43        self.agent_space_id.as_deref()
44    }
45    /// <p>The unique identifier of the threat model job the threat belongs to.</p>
46    pub fn threat_job_id(&self) -> ::std::option::Option<&str> {
47        self.threat_job_id.as_deref()
48    }
49    /// <p>A short title summarizing the threat.</p>
50    pub fn title(&self) -> ::std::option::Option<&str> {
51        self.title.as_deref()
52    }
53    /// <p>The natural-language threat statement.</p>
54    pub fn statement(&self) -> ::std::option::Option<&str> {
55        self.statement.as_deref()
56    }
57    /// <p>The severity level of the threat.</p>
58    pub fn severity(&self) -> ::std::option::Option<&crate::types::ThreatSeverity> {
59        self.severity.as_ref()
60    }
61    /// <p>Optional customer comment on the threat.</p>
62    pub fn comments(&self) -> ::std::option::Option<&str> {
63        self.comments.as_deref()
64    }
65    /// <p>The STRIDE categories applicable to this threat.</p>
66    ///
67    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.stride.is_none()`.
68    pub fn stride(&self) -> &[crate::types::StrideCategory] {
69        self.stride.as_deref().unwrap_or_default()
70    }
71    /// <p>The actor or origin of the threat.</p>
72    pub fn threat_source(&self) -> ::std::option::Option<&str> {
73        self.threat_source.as_deref()
74    }
75    /// <p>The conditions required for the threat to be exploitable.</p>
76    pub fn prerequisites(&self) -> ::std::option::Option<&str> {
77        self.prerequisites.as_deref()
78    }
79    /// <p>What the threat source can do.</p>
80    pub fn threat_action(&self) -> ::std::option::Option<&str> {
81        self.threat_action.as_deref()
82    }
83    /// <p>The direct consequence of the threat action.</p>
84    pub fn threat_impact(&self) -> ::std::option::Option<&str> {
85        self.threat_impact.as_deref()
86    }
87    /// <p>The security goals affected by the threat.</p>
88    ///
89    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.impacted_goal.is_none()`.
90    pub fn impacted_goal(&self) -> &[::std::string::String] {
91        self.impacted_goal.as_deref().unwrap_or_default()
92    }
93    /// <p>The specific assets affected by the threat.</p>
94    ///
95    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.impacted_assets.is_none()`.
96    pub fn impacted_assets(&self) -> &[::std::string::String] {
97        self.impacted_assets.as_deref().unwrap_or_default()
98    }
99    /// <p>The DFD element this threat is anchored to.</p>
100    pub fn anchor(&self) -> ::std::option::Option<&crate::types::ThreatAnchorShape> {
101        self.anchor.as_ref()
102    }
103    /// <p>The source code files supporting the threat.</p>
104    ///
105    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.evidence.is_none()`.
106    pub fn evidence(&self) -> &[crate::types::ThreatEvidenceShape] {
107        self.evidence.as_deref().unwrap_or_default()
108    }
109    /// <p>The recommended mitigation guidance for this threat.</p>
110    pub fn recommendation(&self) -> ::std::option::Option<&str> {
111        self.recommendation.as_deref()
112    }
113}
114impl CreateThreatInput {
115    /// Creates a new builder-style object to manufacture [`CreateThreatInput`](crate::operation::create_threat::CreateThreatInput).
116    pub fn builder() -> crate::operation::create_threat::builders::CreateThreatInputBuilder {
117        crate::operation::create_threat::builders::CreateThreatInputBuilder::default()
118    }
119}
120
121/// A builder for [`CreateThreatInput`](crate::operation::create_threat::CreateThreatInput).
122#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
123#[non_exhaustive]
124pub struct CreateThreatInputBuilder {
125    pub(crate) agent_space_id: ::std::option::Option<::std::string::String>,
126    pub(crate) threat_job_id: ::std::option::Option<::std::string::String>,
127    pub(crate) title: ::std::option::Option<::std::string::String>,
128    pub(crate) statement: ::std::option::Option<::std::string::String>,
129    pub(crate) severity: ::std::option::Option<crate::types::ThreatSeverity>,
130    pub(crate) comments: ::std::option::Option<::std::string::String>,
131    pub(crate) stride: ::std::option::Option<::std::vec::Vec<crate::types::StrideCategory>>,
132    pub(crate) threat_source: ::std::option::Option<::std::string::String>,
133    pub(crate) prerequisites: ::std::option::Option<::std::string::String>,
134    pub(crate) threat_action: ::std::option::Option<::std::string::String>,
135    pub(crate) threat_impact: ::std::option::Option<::std::string::String>,
136    pub(crate) impacted_goal: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
137    pub(crate) impacted_assets: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
138    pub(crate) anchor: ::std::option::Option<crate::types::ThreatAnchorShape>,
139    pub(crate) evidence: ::std::option::Option<::std::vec::Vec<crate::types::ThreatEvidenceShape>>,
140    pub(crate) recommendation: ::std::option::Option<::std::string::String>,
141}
142impl CreateThreatInputBuilder {
143    /// <p>The unique identifier of the agent space.</p>
144    /// This field is required.
145    pub fn agent_space_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
146        self.agent_space_id = ::std::option::Option::Some(input.into());
147        self
148    }
149    /// <p>The unique identifier of the agent space.</p>
150    pub fn set_agent_space_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
151        self.agent_space_id = input;
152        self
153    }
154    /// <p>The unique identifier of the agent space.</p>
155    pub fn get_agent_space_id(&self) -> &::std::option::Option<::std::string::String> {
156        &self.agent_space_id
157    }
158    /// <p>The unique identifier of the threat model job the threat belongs to.</p>
159    /// This field is required.
160    pub fn threat_job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161        self.threat_job_id = ::std::option::Option::Some(input.into());
162        self
163    }
164    /// <p>The unique identifier of the threat model job the threat belongs to.</p>
165    pub fn set_threat_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166        self.threat_job_id = input;
167        self
168    }
169    /// <p>The unique identifier of the threat model job the threat belongs to.</p>
170    pub fn get_threat_job_id(&self) -> &::std::option::Option<::std::string::String> {
171        &self.threat_job_id
172    }
173    /// <p>A short title summarizing the threat.</p>
174    pub fn title(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
175        self.title = ::std::option::Option::Some(input.into());
176        self
177    }
178    /// <p>A short title summarizing the threat.</p>
179    pub fn set_title(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
180        self.title = input;
181        self
182    }
183    /// <p>A short title summarizing the threat.</p>
184    pub fn get_title(&self) -> &::std::option::Option<::std::string::String> {
185        &self.title
186    }
187    /// <p>The natural-language threat statement.</p>
188    pub fn statement(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
189        self.statement = ::std::option::Option::Some(input.into());
190        self
191    }
192    /// <p>The natural-language threat statement.</p>
193    pub fn set_statement(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
194        self.statement = input;
195        self
196    }
197    /// <p>The natural-language threat statement.</p>
198    pub fn get_statement(&self) -> &::std::option::Option<::std::string::String> {
199        &self.statement
200    }
201    /// <p>The severity level of the threat.</p>
202    pub fn severity(mut self, input: crate::types::ThreatSeverity) -> Self {
203        self.severity = ::std::option::Option::Some(input);
204        self
205    }
206    /// <p>The severity level of the threat.</p>
207    pub fn set_severity(mut self, input: ::std::option::Option<crate::types::ThreatSeverity>) -> Self {
208        self.severity = input;
209        self
210    }
211    /// <p>The severity level of the threat.</p>
212    pub fn get_severity(&self) -> &::std::option::Option<crate::types::ThreatSeverity> {
213        &self.severity
214    }
215    /// <p>Optional customer comment on the threat.</p>
216    pub fn comments(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
217        self.comments = ::std::option::Option::Some(input.into());
218        self
219    }
220    /// <p>Optional customer comment on the threat.</p>
221    pub fn set_comments(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
222        self.comments = input;
223        self
224    }
225    /// <p>Optional customer comment on the threat.</p>
226    pub fn get_comments(&self) -> &::std::option::Option<::std::string::String> {
227        &self.comments
228    }
229    /// Appends an item to `stride`.
230    ///
231    /// To override the contents of this collection use [`set_stride`](Self::set_stride).
232    ///
233    /// <p>The STRIDE categories applicable to this threat.</p>
234    pub fn stride(mut self, input: crate::types::StrideCategory) -> Self {
235        let mut v = self.stride.unwrap_or_default();
236        v.push(input);
237        self.stride = ::std::option::Option::Some(v);
238        self
239    }
240    /// <p>The STRIDE categories applicable to this threat.</p>
241    pub fn set_stride(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::StrideCategory>>) -> Self {
242        self.stride = input;
243        self
244    }
245    /// <p>The STRIDE categories applicable to this threat.</p>
246    pub fn get_stride(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::StrideCategory>> {
247        &self.stride
248    }
249    /// <p>The actor or origin of the threat.</p>
250    pub fn threat_source(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
251        self.threat_source = ::std::option::Option::Some(input.into());
252        self
253    }
254    /// <p>The actor or origin of the threat.</p>
255    pub fn set_threat_source(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
256        self.threat_source = input;
257        self
258    }
259    /// <p>The actor or origin of the threat.</p>
260    pub fn get_threat_source(&self) -> &::std::option::Option<::std::string::String> {
261        &self.threat_source
262    }
263    /// <p>The conditions required for the threat to be exploitable.</p>
264    pub fn prerequisites(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
265        self.prerequisites = ::std::option::Option::Some(input.into());
266        self
267    }
268    /// <p>The conditions required for the threat to be exploitable.</p>
269    pub fn set_prerequisites(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
270        self.prerequisites = input;
271        self
272    }
273    /// <p>The conditions required for the threat to be exploitable.</p>
274    pub fn get_prerequisites(&self) -> &::std::option::Option<::std::string::String> {
275        &self.prerequisites
276    }
277    /// <p>What the threat source can do.</p>
278    pub fn threat_action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
279        self.threat_action = ::std::option::Option::Some(input.into());
280        self
281    }
282    /// <p>What the threat source can do.</p>
283    pub fn set_threat_action(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
284        self.threat_action = input;
285        self
286    }
287    /// <p>What the threat source can do.</p>
288    pub fn get_threat_action(&self) -> &::std::option::Option<::std::string::String> {
289        &self.threat_action
290    }
291    /// <p>The direct consequence of the threat action.</p>
292    pub fn threat_impact(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
293        self.threat_impact = ::std::option::Option::Some(input.into());
294        self
295    }
296    /// <p>The direct consequence of the threat action.</p>
297    pub fn set_threat_impact(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
298        self.threat_impact = input;
299        self
300    }
301    /// <p>The direct consequence of the threat action.</p>
302    pub fn get_threat_impact(&self) -> &::std::option::Option<::std::string::String> {
303        &self.threat_impact
304    }
305    /// Appends an item to `impacted_goal`.
306    ///
307    /// To override the contents of this collection use [`set_impacted_goal`](Self::set_impacted_goal).
308    ///
309    /// <p>The security goals affected by the threat.</p>
310    pub fn impacted_goal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
311        let mut v = self.impacted_goal.unwrap_or_default();
312        v.push(input.into());
313        self.impacted_goal = ::std::option::Option::Some(v);
314        self
315    }
316    /// <p>The security goals affected by the threat.</p>
317    pub fn set_impacted_goal(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
318        self.impacted_goal = input;
319        self
320    }
321    /// <p>The security goals affected by the threat.</p>
322    pub fn get_impacted_goal(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
323        &self.impacted_goal
324    }
325    /// Appends an item to `impacted_assets`.
326    ///
327    /// To override the contents of this collection use [`set_impacted_assets`](Self::set_impacted_assets).
328    ///
329    /// <p>The specific assets affected by the threat.</p>
330    pub fn impacted_assets(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
331        let mut v = self.impacted_assets.unwrap_or_default();
332        v.push(input.into());
333        self.impacted_assets = ::std::option::Option::Some(v);
334        self
335    }
336    /// <p>The specific assets affected by the threat.</p>
337    pub fn set_impacted_assets(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
338        self.impacted_assets = input;
339        self
340    }
341    /// <p>The specific assets affected by the threat.</p>
342    pub fn get_impacted_assets(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
343        &self.impacted_assets
344    }
345    /// <p>The DFD element this threat is anchored to.</p>
346    pub fn anchor(mut self, input: crate::types::ThreatAnchorShape) -> Self {
347        self.anchor = ::std::option::Option::Some(input);
348        self
349    }
350    /// <p>The DFD element this threat is anchored to.</p>
351    pub fn set_anchor(mut self, input: ::std::option::Option<crate::types::ThreatAnchorShape>) -> Self {
352        self.anchor = input;
353        self
354    }
355    /// <p>The DFD element this threat is anchored to.</p>
356    pub fn get_anchor(&self) -> &::std::option::Option<crate::types::ThreatAnchorShape> {
357        &self.anchor
358    }
359    /// Appends an item to `evidence`.
360    ///
361    /// To override the contents of this collection use [`set_evidence`](Self::set_evidence).
362    ///
363    /// <p>The source code files supporting the threat.</p>
364    pub fn evidence(mut self, input: crate::types::ThreatEvidenceShape) -> Self {
365        let mut v = self.evidence.unwrap_or_default();
366        v.push(input);
367        self.evidence = ::std::option::Option::Some(v);
368        self
369    }
370    /// <p>The source code files supporting the threat.</p>
371    pub fn set_evidence(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ThreatEvidenceShape>>) -> Self {
372        self.evidence = input;
373        self
374    }
375    /// <p>The source code files supporting the threat.</p>
376    pub fn get_evidence(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ThreatEvidenceShape>> {
377        &self.evidence
378    }
379    /// <p>The recommended mitigation guidance for this threat.</p>
380    pub fn recommendation(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
381        self.recommendation = ::std::option::Option::Some(input.into());
382        self
383    }
384    /// <p>The recommended mitigation guidance for this threat.</p>
385    pub fn set_recommendation(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
386        self.recommendation = input;
387        self
388    }
389    /// <p>The recommended mitigation guidance for this threat.</p>
390    pub fn get_recommendation(&self) -> &::std::option::Option<::std::string::String> {
391        &self.recommendation
392    }
393    /// Consumes the builder and constructs a [`CreateThreatInput`](crate::operation::create_threat::CreateThreatInput).
394    pub fn build(
395        self,
396    ) -> ::std::result::Result<crate::operation::create_threat::CreateThreatInput, ::aws_smithy_types::error::operation::BuildError> {
397        ::std::result::Result::Ok(crate::operation::create_threat::CreateThreatInput {
398            agent_space_id: self.agent_space_id,
399            threat_job_id: self.threat_job_id,
400            title: self.title,
401            statement: self.statement,
402            severity: self.severity,
403            comments: self.comments,
404            stride: self.stride,
405            threat_source: self.threat_source,
406            prerequisites: self.prerequisites,
407            threat_action: self.threat_action,
408            threat_impact: self.threat_impact,
409            impacted_goal: self.impacted_goal,
410            impacted_assets: self.impacted_assets,
411            anchor: self.anchor,
412            evidence: self.evidence,
413            recommendation: self.recommendation,
414        })
415    }
416}