Skip to main content

aws_sdk_datasync/operation/delete_agent/
_delete_agent_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>DeleteAgentRequest</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct DeleteAgentInput {
7    /// <p>The Amazon Resource Name (ARN) of the agent to delete. Use the <code>ListAgents</code> operation to return a list of agents for your account and Amazon Web Services Region.</p>
8    pub agent_arn: ::std::option::Option<::std::string::String>,
9}
10impl DeleteAgentInput {
11    /// <p>The Amazon Resource Name (ARN) of the agent to delete. Use the <code>ListAgents</code> operation to return a list of agents for your account and Amazon Web Services Region.</p>
12    pub fn agent_arn(&self) -> ::std::option::Option<&str> {
13        self.agent_arn.as_deref()
14    }
15}
16static DELETEAGENTINPUT_MEMBER_AGENT_ARN: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
17    ::aws_smithy_schema::ShapeId::from_parts(
18        "com.amazonaws.datasync.synthetic#DeleteAgentInput$AgentArn",
19        "com.amazonaws.datasync.synthetic",
20        "DeleteAgentInput",
21    ),
22    ::aws_smithy_schema::ShapeType::String,
23    "AgentArn",
24    0,
25);
26static DELETEAGENTINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
27    ::aws_smithy_schema::ShapeId::from_parts(
28        "com.amazonaws.datasync.synthetic#DeleteAgentInput",
29        "com.amazonaws.datasync.synthetic",
30        "DeleteAgentInput",
31    ),
32    ::aws_smithy_schema::ShapeType::Structure,
33    &[&DELETEAGENTINPUT_MEMBER_AGENT_ARN],
34)
35.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
36.with_original_name("DeleteAgentRequest");
37impl DeleteAgentInput {
38    /// The schema for this shape.
39    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &DELETEAGENTINPUT_SCHEMA;
40}
41impl ::aws_smithy_schema::serde::SerializableStruct for DeleteAgentInput {
42    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
43        Self::SCHEMA
44    }
45
46    #[allow(unused_variables, clippy::diverging_sub_expression)]
47    fn serialize_members(
48        &self,
49        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
50    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
51        if let Some(ref val) = self.agent_arn {
52            ser.write_string(&DELETEAGENTINPUT_MEMBER_AGENT_ARN, val)?;
53        }
54        Ok(())
55    }
56}
57impl crate::operation::delete_agent::builders::DeleteAgentInputBuilder {
58    #[allow(
59        unused_variables,
60        unreachable_code,
61        clippy::single_match,
62        clippy::match_single_binding,
63        clippy::diverging_sub_expression
64    )]
65    pub(crate) fn deserialize_members(
66        &mut self,
67        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
68    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
69        deserializer.read_struct(&DELETEAGENTINPUT_SCHEMA, &mut |member, deser| {
70            match member.member_index() {
71                Some(0) => {
72                    if deser.is_null() {
73                        deser.read_null()?;
74                    } else {
75                        self.agent_arn = Some(deser.read_string(member)?);
76                    }
77                }
78                _ => {}
79            }
80            Ok(())
81        })
82    }
83}
84
85impl DeleteAgentInput {
86    /// Deserializes this structure from a [`ShapeDeserializer`].
87    pub fn deserialize(
88        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
89    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
90        let mut builder = Self::builder();
91        builder.deserialize_members(deserializer)?;
92        builder.agent_arn = builder.agent_arn.or(Some(String::new()));
93        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
94    }
95}
96impl DeleteAgentInput {
97    /// Creates a new builder-style object to manufacture [`DeleteAgentInput`](crate::operation::delete_agent::DeleteAgentInput).
98    pub fn builder() -> crate::operation::delete_agent::builders::DeleteAgentInputBuilder {
99        crate::operation::delete_agent::builders::DeleteAgentInputBuilder::default()
100    }
101}
102
103/// A builder for [`DeleteAgentInput`](crate::operation::delete_agent::DeleteAgentInput).
104#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
105#[non_exhaustive]
106pub struct DeleteAgentInputBuilder {
107    pub(crate) agent_arn: ::std::option::Option<::std::string::String>,
108}
109impl DeleteAgentInputBuilder {
110    /// <p>The Amazon Resource Name (ARN) of the agent to delete. Use the <code>ListAgents</code> operation to return a list of agents for your account and Amazon Web Services Region.</p>
111    /// This field is required.
112    pub fn agent_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
113        self.agent_arn = ::std::option::Option::Some(input.into());
114        self
115    }
116    /// <p>The Amazon Resource Name (ARN) of the agent to delete. Use the <code>ListAgents</code> operation to return a list of agents for your account and Amazon Web Services Region.</p>
117    pub fn set_agent_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
118        self.agent_arn = input;
119        self
120    }
121    /// <p>The Amazon Resource Name (ARN) of the agent to delete. Use the <code>ListAgents</code> operation to return a list of agents for your account and Amazon Web Services Region.</p>
122    pub fn get_agent_arn(&self) -> &::std::option::Option<::std::string::String> {
123        &self.agent_arn
124    }
125    /// Consumes the builder and constructs a [`DeleteAgentInput`](crate::operation::delete_agent::DeleteAgentInput).
126    pub fn build(self) -> ::std::result::Result<crate::operation::delete_agent::DeleteAgentInput, ::aws_smithy_types::error::operation::BuildError> {
127        ::std::result::Result::Ok(crate::operation::delete_agent::DeleteAgentInput { agent_arn: self.agent_arn })
128    }
129}