1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Detailed information about the agent.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct AgentDetails {
/// <p>Current agent version.</p>
pub agent_version: ::std::string::String,
/// <p>ID of EC2 instance agent is running on.</p>
pub instance_id: ::std::string::String,
/// <p>Type of EC2 instance agent is running on.</p>
pub instance_type: ::std::string::String,
/// <note>
/// <p>This field should not be used. Use agentCpuCores instead.</p>
/// </note>
/// <p>List of CPU cores reserved for processes other than the agent running on the EC2 instance.</p>
pub reserved_cpu_cores: ::std::option::Option<::std::vec::Vec<i32>>,
/// <p>List of CPU cores reserved for the agent.</p>
pub agent_cpu_cores: ::std::option::Option<::std::vec::Vec<i32>>,
/// <p>List of versions being used by agent components.</p>
pub component_versions: ::std::vec::Vec<crate::types::ComponentVersion>,
}
impl AgentDetails {
/// <p>Current agent version.</p>
pub fn agent_version(&self) -> &str {
use std::ops::Deref;
self.agent_version.deref()
}
/// <p>ID of EC2 instance agent is running on.</p>
pub fn instance_id(&self) -> &str {
use std::ops::Deref;
self.instance_id.deref()
}
/// <p>Type of EC2 instance agent is running on.</p>
pub fn instance_type(&self) -> &str {
use std::ops::Deref;
self.instance_type.deref()
}
/// <note>
/// <p>This field should not be used. Use agentCpuCores instead.</p>
/// </note>
/// <p>List of CPU cores reserved for processes other than the agent running on the EC2 instance.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.reserved_cpu_cores.is_none()`.
pub fn reserved_cpu_cores(&self) -> &[i32] {
self.reserved_cpu_cores.as_deref().unwrap_or_default()
}
/// <p>List of CPU cores reserved for the agent.</p>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.agent_cpu_cores.is_none()`.
pub fn agent_cpu_cores(&self) -> &[i32] {
self.agent_cpu_cores.as_deref().unwrap_or_default()
}
/// <p>List of versions being used by agent components.</p>
pub fn component_versions(&self) -> &[crate::types::ComponentVersion] {
use std::ops::Deref;
self.component_versions.deref()
}
}
impl AgentDetails {
/// Creates a new builder-style object to manufacture [`AgentDetails`](crate::types::AgentDetails).
pub fn builder() -> crate::types::builders::AgentDetailsBuilder {
crate::types::builders::AgentDetailsBuilder::default()
}
}
/// A builder for [`AgentDetails`](crate::types::AgentDetails).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct AgentDetailsBuilder {
pub(crate) agent_version: ::std::option::Option<::std::string::String>,
pub(crate) instance_id: ::std::option::Option<::std::string::String>,
pub(crate) instance_type: ::std::option::Option<::std::string::String>,
pub(crate) reserved_cpu_cores: ::std::option::Option<::std::vec::Vec<i32>>,
pub(crate) agent_cpu_cores: ::std::option::Option<::std::vec::Vec<i32>>,
pub(crate) component_versions: ::std::option::Option<::std::vec::Vec<crate::types::ComponentVersion>>,
}
impl AgentDetailsBuilder {
/// <p>Current agent version.</p>
/// This field is required.
pub fn agent_version(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.agent_version = ::std::option::Option::Some(input.into());
self
}
/// <p>Current agent version.</p>
pub fn set_agent_version(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.agent_version = input;
self
}
/// <p>Current agent version.</p>
pub fn get_agent_version(&self) -> &::std::option::Option<::std::string::String> {
&self.agent_version
}
/// <p>ID of EC2 instance agent is running on.</p>
/// This field is required.
pub fn instance_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.instance_id = ::std::option::Option::Some(input.into());
self
}
/// <p>ID of EC2 instance agent is running on.</p>
pub fn set_instance_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.instance_id = input;
self
}
/// <p>ID of EC2 instance agent is running on.</p>
pub fn get_instance_id(&self) -> &::std::option::Option<::std::string::String> {
&self.instance_id
}
/// <p>Type of EC2 instance agent is running on.</p>
/// This field is required.
pub fn instance_type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.instance_type = ::std::option::Option::Some(input.into());
self
}
/// <p>Type of EC2 instance agent is running on.</p>
pub fn set_instance_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.instance_type = input;
self
}
/// <p>Type of EC2 instance agent is running on.</p>
pub fn get_instance_type(&self) -> &::std::option::Option<::std::string::String> {
&self.instance_type
}
/// Appends an item to `reserved_cpu_cores`.
///
/// To override the contents of this collection use [`set_reserved_cpu_cores`](Self::set_reserved_cpu_cores).
///
/// <note>
/// <p>This field should not be used. Use agentCpuCores instead.</p>
/// </note>
/// <p>List of CPU cores reserved for processes other than the agent running on the EC2 instance.</p>
pub fn reserved_cpu_cores(mut self, input: i32) -> Self {
let mut v = self.reserved_cpu_cores.unwrap_or_default();
v.push(input);
self.reserved_cpu_cores = ::std::option::Option::Some(v);
self
}
/// <note>
/// <p>This field should not be used. Use agentCpuCores instead.</p>
/// </note>
/// <p>List of CPU cores reserved for processes other than the agent running on the EC2 instance.</p>
pub fn set_reserved_cpu_cores(mut self, input: ::std::option::Option<::std::vec::Vec<i32>>) -> Self {
self.reserved_cpu_cores = input;
self
}
/// <note>
/// <p>This field should not be used. Use agentCpuCores instead.</p>
/// </note>
/// <p>List of CPU cores reserved for processes other than the agent running on the EC2 instance.</p>
pub fn get_reserved_cpu_cores(&self) -> &::std::option::Option<::std::vec::Vec<i32>> {
&self.reserved_cpu_cores
}
/// Appends an item to `agent_cpu_cores`.
///
/// To override the contents of this collection use [`set_agent_cpu_cores`](Self::set_agent_cpu_cores).
///
/// <p>List of CPU cores reserved for the agent.</p>
pub fn agent_cpu_cores(mut self, input: i32) -> Self {
let mut v = self.agent_cpu_cores.unwrap_or_default();
v.push(input);
self.agent_cpu_cores = ::std::option::Option::Some(v);
self
}
/// <p>List of CPU cores reserved for the agent.</p>
pub fn set_agent_cpu_cores(mut self, input: ::std::option::Option<::std::vec::Vec<i32>>) -> Self {
self.agent_cpu_cores = input;
self
}
/// <p>List of CPU cores reserved for the agent.</p>
pub fn get_agent_cpu_cores(&self) -> &::std::option::Option<::std::vec::Vec<i32>> {
&self.agent_cpu_cores
}
/// Appends an item to `component_versions`.
///
/// To override the contents of this collection use [`set_component_versions`](Self::set_component_versions).
///
/// <p>List of versions being used by agent components.</p>
pub fn component_versions(mut self, input: crate::types::ComponentVersion) -> Self {
let mut v = self.component_versions.unwrap_or_default();
v.push(input);
self.component_versions = ::std::option::Option::Some(v);
self
}
/// <p>List of versions being used by agent components.</p>
pub fn set_component_versions(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ComponentVersion>>) -> Self {
self.component_versions = input;
self
}
/// <p>List of versions being used by agent components.</p>
pub fn get_component_versions(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ComponentVersion>> {
&self.component_versions
}
/// Consumes the builder and constructs a [`AgentDetails`](crate::types::AgentDetails).
/// This method will fail if any of the following fields are not set:
/// - [`agent_version`](crate::types::builders::AgentDetailsBuilder::agent_version)
/// - [`instance_id`](crate::types::builders::AgentDetailsBuilder::instance_id)
/// - [`instance_type`](crate::types::builders::AgentDetailsBuilder::instance_type)
/// - [`component_versions`](crate::types::builders::AgentDetailsBuilder::component_versions)
pub fn build(self) -> ::std::result::Result<crate::types::AgentDetails, ::aws_smithy_types::error::operation::BuildError> {
::std::result::Result::Ok(crate::types::AgentDetails {
agent_version: self.agent_version.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"agent_version",
"agent_version was not specified but it is required when building AgentDetails",
)
})?,
instance_id: self.instance_id.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"instance_id",
"instance_id was not specified but it is required when building AgentDetails",
)
})?,
instance_type: self.instance_type.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"instance_type",
"instance_type was not specified but it is required when building AgentDetails",
)
})?,
reserved_cpu_cores: self.reserved_cpu_cores,
agent_cpu_cores: self.agent_cpu_cores,
component_versions: self.component_versions.ok_or_else(|| {
::aws_smithy_types::error::operation::BuildError::missing_field(
"component_versions",
"component_versions was not specified but it is required when building AgentDetails",
)
})?,
})
}
}