aws_sdk_elasticloadbalancingv2/operation/register_targets/
_register_targets_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct RegisterTargetsInput {
6    /// <p>The Amazon Resource Name (ARN) of the target group.</p>
7    pub target_group_arn: ::std::option::Option<::std::string::String>,
8    /// <p>The targets.</p>
9    pub targets: ::std::option::Option<::std::vec::Vec<crate::types::TargetDescription>>,
10}
11impl RegisterTargetsInput {
12    /// <p>The Amazon Resource Name (ARN) of the target group.</p>
13    pub fn target_group_arn(&self) -> ::std::option::Option<&str> {
14        self.target_group_arn.as_deref()
15    }
16    /// <p>The targets.</p>
17    ///
18    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.targets.is_none()`.
19    pub fn targets(&self) -> &[crate::types::TargetDescription] {
20        self.targets.as_deref().unwrap_or_default()
21    }
22}
23impl RegisterTargetsInput {
24    /// Creates a new builder-style object to manufacture [`RegisterTargetsInput`](crate::operation::register_targets::RegisterTargetsInput).
25    pub fn builder() -> crate::operation::register_targets::builders::RegisterTargetsInputBuilder {
26        crate::operation::register_targets::builders::RegisterTargetsInputBuilder::default()
27    }
28}
29
30/// A builder for [`RegisterTargetsInput`](crate::operation::register_targets::RegisterTargetsInput).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct RegisterTargetsInputBuilder {
34    pub(crate) target_group_arn: ::std::option::Option<::std::string::String>,
35    pub(crate) targets: ::std::option::Option<::std::vec::Vec<crate::types::TargetDescription>>,
36}
37impl RegisterTargetsInputBuilder {
38    /// <p>The Amazon Resource Name (ARN) of the target group.</p>
39    /// This field is required.
40    pub fn target_group_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
41        self.target_group_arn = ::std::option::Option::Some(input.into());
42        self
43    }
44    /// <p>The Amazon Resource Name (ARN) of the target group.</p>
45    pub fn set_target_group_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
46        self.target_group_arn = input;
47        self
48    }
49    /// <p>The Amazon Resource Name (ARN) of the target group.</p>
50    pub fn get_target_group_arn(&self) -> &::std::option::Option<::std::string::String> {
51        &self.target_group_arn
52    }
53    /// Appends an item to `targets`.
54    ///
55    /// To override the contents of this collection use [`set_targets`](Self::set_targets).
56    ///
57    /// <p>The targets.</p>
58    pub fn targets(mut self, input: crate::types::TargetDescription) -> Self {
59        let mut v = self.targets.unwrap_or_default();
60        v.push(input);
61        self.targets = ::std::option::Option::Some(v);
62        self
63    }
64    /// <p>The targets.</p>
65    pub fn set_targets(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TargetDescription>>) -> Self {
66        self.targets = input;
67        self
68    }
69    /// <p>The targets.</p>
70    pub fn get_targets(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TargetDescription>> {
71        &self.targets
72    }
73    /// Consumes the builder and constructs a [`RegisterTargetsInput`](crate::operation::register_targets::RegisterTargetsInput).
74    pub fn build(
75        self,
76    ) -> ::std::result::Result<crate::operation::register_targets::RegisterTargetsInput, ::aws_smithy_types::error::operation::BuildError> {
77        ::std::result::Result::Ok(crate::operation::register_targets::RegisterTargetsInput {
78            target_group_arn: self.target_group_arn,
79            targets: self.targets,
80        })
81    }
82}