Skip to main content

aws_sdk_datasync/operation/update_agent/
_update_agent_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>UpdateAgentRequest</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct UpdateAgentInput {
7    /// <p>The Amazon Resource Name (ARN) of the agent to update.</p>
8    pub agent_arn: ::std::option::Option<::std::string::String>,
9    /// <p>The name that you want to use to configure the agent.</p>
10    pub name: ::std::option::Option<::std::string::String>,
11}
12impl UpdateAgentInput {
13    /// <p>The Amazon Resource Name (ARN) of the agent to update.</p>
14    pub fn agent_arn(&self) -> ::std::option::Option<&str> {
15        self.agent_arn.as_deref()
16    }
17    /// <p>The name that you want to use to configure the agent.</p>
18    pub fn name(&self) -> ::std::option::Option<&str> {
19        self.name.as_deref()
20    }
21}
22static UPDATEAGENTINPUT_MEMBER_AGENT_ARN: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
23    ::aws_smithy_schema::ShapeId::from_parts(
24        "com.amazonaws.datasync.synthetic#UpdateAgentInput$AgentArn",
25        "com.amazonaws.datasync.synthetic",
26        "UpdateAgentInput",
27    ),
28    ::aws_smithy_schema::ShapeType::String,
29    "AgentArn",
30    0,
31);
32static UPDATEAGENTINPUT_MEMBER_NAME: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_member(
33    ::aws_smithy_schema::ShapeId::from_parts(
34        "com.amazonaws.datasync.synthetic#UpdateAgentInput$Name",
35        "com.amazonaws.datasync.synthetic",
36        "UpdateAgentInput",
37    ),
38    ::aws_smithy_schema::ShapeType::String,
39    "Name",
40    1,
41);
42static UPDATEAGENTINPUT_SCHEMA: ::aws_smithy_schema::Schema<'static> = ::aws_smithy_schema::Schema::new_struct(
43    ::aws_smithy_schema::ShapeId::from_parts(
44        "com.amazonaws.datasync.synthetic#UpdateAgentInput",
45        "com.amazonaws.datasync.synthetic",
46        "UpdateAgentInput",
47    ),
48    ::aws_smithy_schema::ShapeType::Structure,
49    &[&UPDATEAGENTINPUT_MEMBER_AGENT_ARN, &UPDATEAGENTINPUT_MEMBER_NAME],
50)
51.with_payload_hint(::aws_smithy_schema::PayloadHint::NoStructPayload)
52.with_original_name("UpdateAgentRequest");
53impl UpdateAgentInput {
54    /// The schema for this shape.
55    pub const SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = &UPDATEAGENTINPUT_SCHEMA;
56}
57impl ::aws_smithy_schema::serde::SerializableStruct for UpdateAgentInput {
58    fn schema(&self) -> &::aws_smithy_schema::Schema<'_> {
59        Self::SCHEMA
60    }
61
62    #[allow(unused_variables, clippy::diverging_sub_expression)]
63    fn serialize_members(
64        &self,
65        ser: &mut dyn ::aws_smithy_schema::serde::ShapeSerializer,
66    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
67        if let Some(ref val) = self.agent_arn {
68            ser.write_string(&UPDATEAGENTINPUT_MEMBER_AGENT_ARN, val)?;
69        }
70        if let Some(ref val) = self.name {
71            ser.write_string(&UPDATEAGENTINPUT_MEMBER_NAME, val)?;
72        }
73        Ok(())
74    }
75}
76impl crate::operation::update_agent::builders::UpdateAgentInputBuilder {
77    #[allow(
78        unused_variables,
79        unreachable_code,
80        clippy::single_match,
81        clippy::match_single_binding,
82        clippy::diverging_sub_expression
83    )]
84    pub(crate) fn deserialize_members(
85        &mut self,
86        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
87    ) -> ::std::result::Result<(), ::aws_smithy_schema::serde::SerdeError> {
88        deserializer.read_struct(&UPDATEAGENTINPUT_SCHEMA, &mut |member, deser| {
89            match member.member_index() {
90                Some(0) => {
91                    if deser.is_null() {
92                        deser.read_null()?;
93                    } else {
94                        self.agent_arn = Some(deser.read_string(member)?);
95                    }
96                }
97                Some(1) => {
98                    if deser.is_null() {
99                        deser.read_null()?;
100                    } else {
101                        self.name = Some(deser.read_string(member)?);
102                    }
103                }
104                _ => {}
105            }
106            Ok(())
107        })
108    }
109}
110
111impl UpdateAgentInput {
112    /// Deserializes this structure from a [`ShapeDeserializer`].
113    pub fn deserialize(
114        deserializer: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer,
115    ) -> ::std::result::Result<Self, ::aws_smithy_schema::serde::SerdeError> {
116        let mut builder = Self::builder();
117        builder.deserialize_members(deserializer)?;
118        builder.agent_arn = builder.agent_arn.or(Some(String::new()));
119        builder.build().map_err(|e| aws_smithy_schema::serde::SerdeError::custom(e.to_string()))
120    }
121}
122impl UpdateAgentInput {
123    /// Creates a new builder-style object to manufacture [`UpdateAgentInput`](crate::operation::update_agent::UpdateAgentInput).
124    pub fn builder() -> crate::operation::update_agent::builders::UpdateAgentInputBuilder {
125        crate::operation::update_agent::builders::UpdateAgentInputBuilder::default()
126    }
127}
128
129/// A builder for [`UpdateAgentInput`](crate::operation::update_agent::UpdateAgentInput).
130#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
131#[non_exhaustive]
132pub struct UpdateAgentInputBuilder {
133    pub(crate) agent_arn: ::std::option::Option<::std::string::String>,
134    pub(crate) name: ::std::option::Option<::std::string::String>,
135}
136impl UpdateAgentInputBuilder {
137    /// <p>The Amazon Resource Name (ARN) of the agent to update.</p>
138    /// This field is required.
139    pub fn agent_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
140        self.agent_arn = ::std::option::Option::Some(input.into());
141        self
142    }
143    /// <p>The Amazon Resource Name (ARN) of the agent to update.</p>
144    pub fn set_agent_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
145        self.agent_arn = input;
146        self
147    }
148    /// <p>The Amazon Resource Name (ARN) of the agent to update.</p>
149    pub fn get_agent_arn(&self) -> &::std::option::Option<::std::string::String> {
150        &self.agent_arn
151    }
152    /// <p>The name that you want to use to configure the agent.</p>
153    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
154        self.name = ::std::option::Option::Some(input.into());
155        self
156    }
157    /// <p>The name that you want to use to configure the agent.</p>
158    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
159        self.name = input;
160        self
161    }
162    /// <p>The name that you want to use to configure the agent.</p>
163    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
164        &self.name
165    }
166    /// Consumes the builder and constructs a [`UpdateAgentInput`](crate::operation::update_agent::UpdateAgentInput).
167    pub fn build(self) -> ::std::result::Result<crate::operation::update_agent::UpdateAgentInput, ::aws_smithy_types::error::operation::BuildError> {
168        ::std::result::Result::Ok(crate::operation::update_agent::UpdateAgentInput {
169            agent_arn: self.agent_arn,
170            name: self.name,
171        })
172    }
173}