Skip to main content

aws_sdk_applicationdiscovery/types/
_batch_delete_agent_error.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An object representing the agent or data collector that failed to delete, each containing agentId, errorMessage, and errorCode.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct BatchDeleteAgentError {
7    /// <p>The ID of the agent or data collector to delete.</p>
8    pub agent_id: ::std::string::String,
9    /// <p>The description of the error that occurred for the delete failed agent.</p>
10    pub error_message: ::std::string::String,
11    /// <p>The type of error that occurred for the delete failed agent. Valid status are: AGENT_IN_USE | NOT_FOUND | INTERNAL_SERVER_ERROR.</p>
12    pub error_code: crate::types::DeleteAgentErrorCode,
13}
14impl BatchDeleteAgentError {
15    /// <p>The ID of the agent or data collector to delete.</p>
16    pub fn agent_id(&self) -> &str {
17        use std::ops::Deref;
18        self.agent_id.deref()
19    }
20    /// <p>The description of the error that occurred for the delete failed agent.</p>
21    pub fn error_message(&self) -> &str {
22        use std::ops::Deref;
23        self.error_message.deref()
24    }
25    /// <p>The type of error that occurred for the delete failed agent. Valid status are: AGENT_IN_USE | NOT_FOUND | INTERNAL_SERVER_ERROR.</p>
26    pub fn error_code(&self) -> &crate::types::DeleteAgentErrorCode {
27        &self.error_code
28    }
29}
30impl BatchDeleteAgentError {
31    /// Creates a new builder-style object to manufacture [`BatchDeleteAgentError`](crate::types::BatchDeleteAgentError).
32    pub fn builder() -> crate::types::builders::BatchDeleteAgentErrorBuilder {
33        crate::types::builders::BatchDeleteAgentErrorBuilder::default()
34    }
35}
36
37/// A builder for [`BatchDeleteAgentError`](crate::types::BatchDeleteAgentError).
38#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
39#[non_exhaustive]
40pub struct BatchDeleteAgentErrorBuilder {
41    pub(crate) agent_id: ::std::option::Option<::std::string::String>,
42    pub(crate) error_message: ::std::option::Option<::std::string::String>,
43    pub(crate) error_code: ::std::option::Option<crate::types::DeleteAgentErrorCode>,
44}
45impl BatchDeleteAgentErrorBuilder {
46    /// <p>The ID of the agent or data collector to delete.</p>
47    /// This field is required.
48    pub fn agent_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
49        self.agent_id = ::std::option::Option::Some(input.into());
50        self
51    }
52    /// <p>The ID of the agent or data collector to delete.</p>
53    pub fn set_agent_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
54        self.agent_id = input;
55        self
56    }
57    /// <p>The ID of the agent or data collector to delete.</p>
58    pub fn get_agent_id(&self) -> &::std::option::Option<::std::string::String> {
59        &self.agent_id
60    }
61    /// <p>The description of the error that occurred for the delete failed agent.</p>
62    /// This field is required.
63    pub fn error_message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
64        self.error_message = ::std::option::Option::Some(input.into());
65        self
66    }
67    /// <p>The description of the error that occurred for the delete failed agent.</p>
68    pub fn set_error_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
69        self.error_message = input;
70        self
71    }
72    /// <p>The description of the error that occurred for the delete failed agent.</p>
73    pub fn get_error_message(&self) -> &::std::option::Option<::std::string::String> {
74        &self.error_message
75    }
76    /// <p>The type of error that occurred for the delete failed agent. Valid status are: AGENT_IN_USE | NOT_FOUND | INTERNAL_SERVER_ERROR.</p>
77    /// This field is required.
78    pub fn error_code(mut self, input: crate::types::DeleteAgentErrorCode) -> Self {
79        self.error_code = ::std::option::Option::Some(input);
80        self
81    }
82    /// <p>The type of error that occurred for the delete failed agent. Valid status are: AGENT_IN_USE | NOT_FOUND | INTERNAL_SERVER_ERROR.</p>
83    pub fn set_error_code(mut self, input: ::std::option::Option<crate::types::DeleteAgentErrorCode>) -> Self {
84        self.error_code = input;
85        self
86    }
87    /// <p>The type of error that occurred for the delete failed agent. Valid status are: AGENT_IN_USE | NOT_FOUND | INTERNAL_SERVER_ERROR.</p>
88    pub fn get_error_code(&self) -> &::std::option::Option<crate::types::DeleteAgentErrorCode> {
89        &self.error_code
90    }
91    /// Consumes the builder and constructs a [`BatchDeleteAgentError`](crate::types::BatchDeleteAgentError).
92    /// This method will fail if any of the following fields are not set:
93    /// - [`agent_id`](crate::types::builders::BatchDeleteAgentErrorBuilder::agent_id)
94    /// - [`error_message`](crate::types::builders::BatchDeleteAgentErrorBuilder::error_message)
95    /// - [`error_code`](crate::types::builders::BatchDeleteAgentErrorBuilder::error_code)
96    pub fn build(self) -> ::std::result::Result<crate::types::BatchDeleteAgentError, ::aws_smithy_types::error::operation::BuildError> {
97        ::std::result::Result::Ok(crate::types::BatchDeleteAgentError {
98            agent_id: self.agent_id.ok_or_else(|| {
99                ::aws_smithy_types::error::operation::BuildError::missing_field(
100                    "agent_id",
101                    "agent_id was not specified but it is required when building BatchDeleteAgentError",
102                )
103            })?,
104            error_message: self.error_message.ok_or_else(|| {
105                ::aws_smithy_types::error::operation::BuildError::missing_field(
106                    "error_message",
107                    "error_message was not specified but it is required when building BatchDeleteAgentError",
108                )
109            })?,
110            error_code: self.error_code.ok_or_else(|| {
111                ::aws_smithy_types::error::operation::BuildError::missing_field(
112                    "error_code",
113                    "error_code was not specified but it is required when building BatchDeleteAgentError",
114                )
115            })?,
116        })
117    }
118}