Skip to main content

aws_sdk_ecs/types/
_managed_agent_state_change.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>An object representing a change in state for a managed agent.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct ManagedAgentStateChange {
7    /// <p>The name of the container that's associated with the managed agent.</p>
8    pub container_name: ::std::string::String,
9    /// <p>The name of the managed agent.</p>
10    pub managed_agent_name: crate::types::ManagedAgentName,
11    /// <p>The status of the managed agent.</p>
12    pub status: ::std::string::String,
13    /// <p>The reason for the status of the managed agent.</p>
14    pub reason: ::std::option::Option<::std::string::String>,
15}
16impl ManagedAgentStateChange {
17    /// <p>The name of the container that's associated with the managed agent.</p>
18    pub fn container_name(&self) -> &str {
19        use std::ops::Deref;
20        self.container_name.deref()
21    }
22    /// <p>The name of the managed agent.</p>
23    pub fn managed_agent_name(&self) -> &crate::types::ManagedAgentName {
24        &self.managed_agent_name
25    }
26    /// <p>The status of the managed agent.</p>
27    pub fn status(&self) -> &str {
28        use std::ops::Deref;
29        self.status.deref()
30    }
31    /// <p>The reason for the status of the managed agent.</p>
32    pub fn reason(&self) -> ::std::option::Option<&str> {
33        self.reason.as_deref()
34    }
35}
36impl ManagedAgentStateChange {
37    /// Creates a new builder-style object to manufacture [`ManagedAgentStateChange`](crate::types::ManagedAgentStateChange).
38    pub fn builder() -> crate::types::builders::ManagedAgentStateChangeBuilder {
39        crate::types::builders::ManagedAgentStateChangeBuilder::default()
40    }
41}
42
43/// A builder for [`ManagedAgentStateChange`](crate::types::ManagedAgentStateChange).
44#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
45#[non_exhaustive]
46pub struct ManagedAgentStateChangeBuilder {
47    pub(crate) container_name: ::std::option::Option<::std::string::String>,
48    pub(crate) managed_agent_name: ::std::option::Option<crate::types::ManagedAgentName>,
49    pub(crate) status: ::std::option::Option<::std::string::String>,
50    pub(crate) reason: ::std::option::Option<::std::string::String>,
51}
52impl ManagedAgentStateChangeBuilder {
53    /// <p>The name of the container that's associated with the managed agent.</p>
54    /// This field is required.
55    pub fn container_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
56        self.container_name = ::std::option::Option::Some(input.into());
57        self
58    }
59    /// <p>The name of the container that's associated with the managed agent.</p>
60    pub fn set_container_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
61        self.container_name = input;
62        self
63    }
64    /// <p>The name of the container that's associated with the managed agent.</p>
65    pub fn get_container_name(&self) -> &::std::option::Option<::std::string::String> {
66        &self.container_name
67    }
68    /// <p>The name of the managed agent.</p>
69    /// This field is required.
70    pub fn managed_agent_name(mut self, input: crate::types::ManagedAgentName) -> Self {
71        self.managed_agent_name = ::std::option::Option::Some(input);
72        self
73    }
74    /// <p>The name of the managed agent.</p>
75    pub fn set_managed_agent_name(mut self, input: ::std::option::Option<crate::types::ManagedAgentName>) -> Self {
76        self.managed_agent_name = input;
77        self
78    }
79    /// <p>The name of the managed agent.</p>
80    pub fn get_managed_agent_name(&self) -> &::std::option::Option<crate::types::ManagedAgentName> {
81        &self.managed_agent_name
82    }
83    /// <p>The status of the managed agent.</p>
84    /// This field is required.
85    pub fn status(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
86        self.status = ::std::option::Option::Some(input.into());
87        self
88    }
89    /// <p>The status of the managed agent.</p>
90    pub fn set_status(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
91        self.status = input;
92        self
93    }
94    /// <p>The status of the managed agent.</p>
95    pub fn get_status(&self) -> &::std::option::Option<::std::string::String> {
96        &self.status
97    }
98    /// <p>The reason for the status of the managed agent.</p>
99    pub fn reason(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
100        self.reason = ::std::option::Option::Some(input.into());
101        self
102    }
103    /// <p>The reason for the status of the managed agent.</p>
104    pub fn set_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
105        self.reason = input;
106        self
107    }
108    /// <p>The reason for the status of the managed agent.</p>
109    pub fn get_reason(&self) -> &::std::option::Option<::std::string::String> {
110        &self.reason
111    }
112    /// Consumes the builder and constructs a [`ManagedAgentStateChange`](crate::types::ManagedAgentStateChange).
113    /// This method will fail if any of the following fields are not set:
114    /// - [`container_name`](crate::types::builders::ManagedAgentStateChangeBuilder::container_name)
115    /// - [`managed_agent_name`](crate::types::builders::ManagedAgentStateChangeBuilder::managed_agent_name)
116    /// - [`status`](crate::types::builders::ManagedAgentStateChangeBuilder::status)
117    pub fn build(self) -> ::std::result::Result<crate::types::ManagedAgentStateChange, ::aws_smithy_types::error::operation::BuildError> {
118        ::std::result::Result::Ok(crate::types::ManagedAgentStateChange {
119            container_name: self.container_name.ok_or_else(|| {
120                ::aws_smithy_types::error::operation::BuildError::missing_field(
121                    "container_name",
122                    "container_name was not specified but it is required when building ManagedAgentStateChange",
123                )
124            })?,
125            managed_agent_name: self.managed_agent_name.ok_or_else(|| {
126                ::aws_smithy_types::error::operation::BuildError::missing_field(
127                    "managed_agent_name",
128                    "managed_agent_name was not specified but it is required when building ManagedAgentStateChange",
129                )
130            })?,
131            status: self.status.ok_or_else(|| {
132                ::aws_smithy_types::error::operation::BuildError::missing_field(
133                    "status",
134                    "status was not specified but it is required when building ManagedAgentStateChange",
135                )
136            })?,
137            reason: self.reason,
138        })
139    }
140}