aws_sdk_securityagent/operation/create_threat/
_create_threat_output.rs1#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct CreateThreatOutput {
7 pub threat_id: ::std::string::String,
9 pub threat_job_id: ::std::string::String,
11 pub title: ::std::option::Option<::std::string::String>,
13 pub statement: ::std::option::Option<::std::string::String>,
15 pub severity: ::std::option::Option<crate::types::ThreatSeverity>,
17 pub status: ::std::option::Option<crate::types::ThreatStatus>,
19 pub comments: ::std::option::Option<::std::string::String>,
21 pub stride: ::std::option::Option<::std::vec::Vec<crate::types::StrideCategory>>,
23 pub threat_source: ::std::option::Option<::std::string::String>,
25 pub prerequisites: ::std::option::Option<::std::string::String>,
27 pub threat_action: ::std::option::Option<::std::string::String>,
29 pub threat_impact: ::std::option::Option<::std::string::String>,
31 pub impacted_goal: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
33 pub impacted_assets: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
35 pub anchor: ::std::option::Option<crate::types::ThreatAnchorShape>,
37 pub evidence: ::std::option::Option<::std::vec::Vec<crate::types::ThreatEvidenceShape>>,
39 pub recommendation: ::std::option::Option<::std::string::String>,
41 pub created_by: ::std::option::Option<crate::types::ThreatActor>,
43 pub updated_by: ::std::option::Option<crate::types::ThreatActor>,
45 pub created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
47 pub updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
49 _request_id: Option<String>,
50}
51impl CreateThreatOutput {
52 pub fn threat_id(&self) -> &str {
54 use std::ops::Deref;
55 self.threat_id.deref()
56 }
57 pub fn threat_job_id(&self) -> &str {
59 use std::ops::Deref;
60 self.threat_job_id.deref()
61 }
62 pub fn title(&self) -> ::std::option::Option<&str> {
64 self.title.as_deref()
65 }
66 pub fn statement(&self) -> ::std::option::Option<&str> {
68 self.statement.as_deref()
69 }
70 pub fn severity(&self) -> ::std::option::Option<&crate::types::ThreatSeverity> {
72 self.severity.as_ref()
73 }
74 pub fn status(&self) -> ::std::option::Option<&crate::types::ThreatStatus> {
76 self.status.as_ref()
77 }
78 pub fn comments(&self) -> ::std::option::Option<&str> {
80 self.comments.as_deref()
81 }
82 pub fn stride(&self) -> &[crate::types::StrideCategory] {
86 self.stride.as_deref().unwrap_or_default()
87 }
88 pub fn threat_source(&self) -> ::std::option::Option<&str> {
90 self.threat_source.as_deref()
91 }
92 pub fn prerequisites(&self) -> ::std::option::Option<&str> {
94 self.prerequisites.as_deref()
95 }
96 pub fn threat_action(&self) -> ::std::option::Option<&str> {
98 self.threat_action.as_deref()
99 }
100 pub fn threat_impact(&self) -> ::std::option::Option<&str> {
102 self.threat_impact.as_deref()
103 }
104 pub fn impacted_goal(&self) -> &[::std::string::String] {
108 self.impacted_goal.as_deref().unwrap_or_default()
109 }
110 pub fn impacted_assets(&self) -> &[::std::string::String] {
114 self.impacted_assets.as_deref().unwrap_or_default()
115 }
116 pub fn anchor(&self) -> ::std::option::Option<&crate::types::ThreatAnchorShape> {
118 self.anchor.as_ref()
119 }
120 pub fn evidence(&self) -> &[crate::types::ThreatEvidenceShape] {
124 self.evidence.as_deref().unwrap_or_default()
125 }
126 pub fn recommendation(&self) -> ::std::option::Option<&str> {
128 self.recommendation.as_deref()
129 }
130 pub fn created_by(&self) -> ::std::option::Option<&crate::types::ThreatActor> {
132 self.created_by.as_ref()
133 }
134 pub fn updated_by(&self) -> ::std::option::Option<&crate::types::ThreatActor> {
136 self.updated_by.as_ref()
137 }
138 pub fn created_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
140 self.created_at.as_ref()
141 }
142 pub fn updated_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
144 self.updated_at.as_ref()
145 }
146}
147impl ::aws_types::request_id::RequestId for CreateThreatOutput {
148 fn request_id(&self) -> Option<&str> {
149 self._request_id.as_deref()
150 }
151}
152impl CreateThreatOutput {
153 pub fn builder() -> crate::operation::create_threat::builders::CreateThreatOutputBuilder {
155 crate::operation::create_threat::builders::CreateThreatOutputBuilder::default()
156 }
157}
158
159#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
161#[non_exhaustive]
162pub struct CreateThreatOutputBuilder {
163 pub(crate) threat_id: ::std::option::Option<::std::string::String>,
164 pub(crate) threat_job_id: ::std::option::Option<::std::string::String>,
165 pub(crate) title: ::std::option::Option<::std::string::String>,
166 pub(crate) statement: ::std::option::Option<::std::string::String>,
167 pub(crate) severity: ::std::option::Option<crate::types::ThreatSeverity>,
168 pub(crate) status: ::std::option::Option<crate::types::ThreatStatus>,
169 pub(crate) comments: ::std::option::Option<::std::string::String>,
170 pub(crate) stride: ::std::option::Option<::std::vec::Vec<crate::types::StrideCategory>>,
171 pub(crate) threat_source: ::std::option::Option<::std::string::String>,
172 pub(crate) prerequisites: ::std::option::Option<::std::string::String>,
173 pub(crate) threat_action: ::std::option::Option<::std::string::String>,
174 pub(crate) threat_impact: ::std::option::Option<::std::string::String>,
175 pub(crate) impacted_goal: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
176 pub(crate) impacted_assets: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
177 pub(crate) anchor: ::std::option::Option<crate::types::ThreatAnchorShape>,
178 pub(crate) evidence: ::std::option::Option<::std::vec::Vec<crate::types::ThreatEvidenceShape>>,
179 pub(crate) recommendation: ::std::option::Option<::std::string::String>,
180 pub(crate) created_by: ::std::option::Option<crate::types::ThreatActor>,
181 pub(crate) updated_by: ::std::option::Option<crate::types::ThreatActor>,
182 pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>,
183 pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>,
184 _request_id: Option<String>,
185}
186impl CreateThreatOutputBuilder {
187 pub fn threat_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
190 self.threat_id = ::std::option::Option::Some(input.into());
191 self
192 }
193 pub fn set_threat_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
195 self.threat_id = input;
196 self
197 }
198 pub fn get_threat_id(&self) -> &::std::option::Option<::std::string::String> {
200 &self.threat_id
201 }
202 pub fn threat_job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
205 self.threat_job_id = ::std::option::Option::Some(input.into());
206 self
207 }
208 pub fn set_threat_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
210 self.threat_job_id = input;
211 self
212 }
213 pub fn get_threat_job_id(&self) -> &::std::option::Option<::std::string::String> {
215 &self.threat_job_id
216 }
217 pub fn title(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
219 self.title = ::std::option::Option::Some(input.into());
220 self
221 }
222 pub fn set_title(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
224 self.title = input;
225 self
226 }
227 pub fn get_title(&self) -> &::std::option::Option<::std::string::String> {
229 &self.title
230 }
231 pub fn statement(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
233 self.statement = ::std::option::Option::Some(input.into());
234 self
235 }
236 pub fn set_statement(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
238 self.statement = input;
239 self
240 }
241 pub fn get_statement(&self) -> &::std::option::Option<::std::string::String> {
243 &self.statement
244 }
245 pub fn severity(mut self, input: crate::types::ThreatSeverity) -> Self {
247 self.severity = ::std::option::Option::Some(input);
248 self
249 }
250 pub fn set_severity(mut self, input: ::std::option::Option<crate::types::ThreatSeverity>) -> Self {
252 self.severity = input;
253 self
254 }
255 pub fn get_severity(&self) -> &::std::option::Option<crate::types::ThreatSeverity> {
257 &self.severity
258 }
259 pub fn status(mut self, input: crate::types::ThreatStatus) -> Self {
261 self.status = ::std::option::Option::Some(input);
262 self
263 }
264 pub fn set_status(mut self, input: ::std::option::Option<crate::types::ThreatStatus>) -> Self {
266 self.status = input;
267 self
268 }
269 pub fn get_status(&self) -> &::std::option::Option<crate::types::ThreatStatus> {
271 &self.status
272 }
273 pub fn comments(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
275 self.comments = ::std::option::Option::Some(input.into());
276 self
277 }
278 pub fn set_comments(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
280 self.comments = input;
281 self
282 }
283 pub fn get_comments(&self) -> &::std::option::Option<::std::string::String> {
285 &self.comments
286 }
287 pub fn stride(mut self, input: crate::types::StrideCategory) -> Self {
293 let mut v = self.stride.unwrap_or_default();
294 v.push(input);
295 self.stride = ::std::option::Option::Some(v);
296 self
297 }
298 pub fn set_stride(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::StrideCategory>>) -> Self {
300 self.stride = input;
301 self
302 }
303 pub fn get_stride(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::StrideCategory>> {
305 &self.stride
306 }
307 pub fn threat_source(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
309 self.threat_source = ::std::option::Option::Some(input.into());
310 self
311 }
312 pub fn set_threat_source(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
314 self.threat_source = input;
315 self
316 }
317 pub fn get_threat_source(&self) -> &::std::option::Option<::std::string::String> {
319 &self.threat_source
320 }
321 pub fn prerequisites(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
323 self.prerequisites = ::std::option::Option::Some(input.into());
324 self
325 }
326 pub fn set_prerequisites(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
328 self.prerequisites = input;
329 self
330 }
331 pub fn get_prerequisites(&self) -> &::std::option::Option<::std::string::String> {
333 &self.prerequisites
334 }
335 pub fn threat_action(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
337 self.threat_action = ::std::option::Option::Some(input.into());
338 self
339 }
340 pub fn set_threat_action(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
342 self.threat_action = input;
343 self
344 }
345 pub fn get_threat_action(&self) -> &::std::option::Option<::std::string::String> {
347 &self.threat_action
348 }
349 pub fn threat_impact(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
351 self.threat_impact = ::std::option::Option::Some(input.into());
352 self
353 }
354 pub fn set_threat_impact(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
356 self.threat_impact = input;
357 self
358 }
359 pub fn get_threat_impact(&self) -> &::std::option::Option<::std::string::String> {
361 &self.threat_impact
362 }
363 pub fn impacted_goal(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
369 let mut v = self.impacted_goal.unwrap_or_default();
370 v.push(input.into());
371 self.impacted_goal = ::std::option::Option::Some(v);
372 self
373 }
374 pub fn set_impacted_goal(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
376 self.impacted_goal = input;
377 self
378 }
379 pub fn get_impacted_goal(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
381 &self.impacted_goal
382 }
383 pub fn impacted_assets(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
389 let mut v = self.impacted_assets.unwrap_or_default();
390 v.push(input.into());
391 self.impacted_assets = ::std::option::Option::Some(v);
392 self
393 }
394 pub fn set_impacted_assets(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
396 self.impacted_assets = input;
397 self
398 }
399 pub fn get_impacted_assets(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
401 &self.impacted_assets
402 }
403 pub fn anchor(mut self, input: crate::types::ThreatAnchorShape) -> Self {
405 self.anchor = ::std::option::Option::Some(input);
406 self
407 }
408 pub fn set_anchor(mut self, input: ::std::option::Option<crate::types::ThreatAnchorShape>) -> Self {
410 self.anchor = input;
411 self
412 }
413 pub fn get_anchor(&self) -> &::std::option::Option<crate::types::ThreatAnchorShape> {
415 &self.anchor
416 }
417 pub fn evidence(mut self, input: crate::types::ThreatEvidenceShape) -> Self {
423 let mut v = self.evidence.unwrap_or_default();
424 v.push(input);
425 self.evidence = ::std::option::Option::Some(v);
426 self
427 }
428 pub fn set_evidence(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ThreatEvidenceShape>>) -> Self {
430 self.evidence = input;
431 self
432 }
433 pub fn get_evidence(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ThreatEvidenceShape>> {
435 &self.evidence
436 }
437 pub fn recommendation(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
439 self.recommendation = ::std::option::Option::Some(input.into());
440 self
441 }
442 pub fn set_recommendation(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
444 self.recommendation = input;
445 self
446 }
447 pub fn get_recommendation(&self) -> &::std::option::Option<::std::string::String> {
449 &self.recommendation
450 }
451 pub fn created_by(mut self, input: crate::types::ThreatActor) -> Self {
453 self.created_by = ::std::option::Option::Some(input);
454 self
455 }
456 pub fn set_created_by(mut self, input: ::std::option::Option<crate::types::ThreatActor>) -> Self {
458 self.created_by = input;
459 self
460 }
461 pub fn get_created_by(&self) -> &::std::option::Option<crate::types::ThreatActor> {
463 &self.created_by
464 }
465 pub fn updated_by(mut self, input: crate::types::ThreatActor) -> Self {
467 self.updated_by = ::std::option::Option::Some(input);
468 self
469 }
470 pub fn set_updated_by(mut self, input: ::std::option::Option<crate::types::ThreatActor>) -> Self {
472 self.updated_by = input;
473 self
474 }
475 pub fn get_updated_by(&self) -> &::std::option::Option<crate::types::ThreatActor> {
477 &self.updated_by
478 }
479 pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
481 self.created_at = ::std::option::Option::Some(input);
482 self
483 }
484 pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
486 self.created_at = input;
487 self
488 }
489 pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
491 &self.created_at
492 }
493 pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self {
495 self.updated_at = ::std::option::Option::Some(input);
496 self
497 }
498 pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
500 self.updated_at = input;
501 self
502 }
503 pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
505 &self.updated_at
506 }
507 pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
508 self._request_id = Some(request_id.into());
509 self
510 }
511
512 pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
513 self._request_id = request_id;
514 self
515 }
516 pub fn build(
521 self,
522 ) -> ::std::result::Result<crate::operation::create_threat::CreateThreatOutput, ::aws_smithy_types::error::operation::BuildError> {
523 ::std::result::Result::Ok(crate::operation::create_threat::CreateThreatOutput {
524 threat_id: self.threat_id.ok_or_else(|| {
525 ::aws_smithy_types::error::operation::BuildError::missing_field(
526 "threat_id",
527 "threat_id was not specified but it is required when building CreateThreatOutput",
528 )
529 })?,
530 threat_job_id: self.threat_job_id.ok_or_else(|| {
531 ::aws_smithy_types::error::operation::BuildError::missing_field(
532 "threat_job_id",
533 "threat_job_id was not specified but it is required when building CreateThreatOutput",
534 )
535 })?,
536 title: self.title,
537 statement: self.statement,
538 severity: self.severity,
539 status: self.status,
540 comments: self.comments,
541 stride: self.stride,
542 threat_source: self.threat_source,
543 prerequisites: self.prerequisites,
544 threat_action: self.threat_action,
545 threat_impact: self.threat_impact,
546 impacted_goal: self.impacted_goal,
547 impacted_assets: self.impacted_assets,
548 anchor: self.anchor,
549 evidence: self.evidence,
550 recommendation: self.recommendation,
551 created_by: self.created_by,
552 updated_by: self.updated_by,
553 created_at: self.created_at,
554 updated_at: self.updated_at,
555 _request_id: self._request_id,
556 })
557 }
558}