aws_sdk_cloudwatchevents/operation/put_targets/
_put_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 PutTargetsInput {
6    /// <p>The name of the rule.</p>
7    pub rule: ::std::option::Option<::std::string::String>,
8    /// <p>The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
9    pub event_bus_name: ::std::option::Option<::std::string::String>,
10    /// <p>The targets to update or add to the rule.</p>
11    pub targets: ::std::option::Option<::std::vec::Vec<crate::types::Target>>,
12}
13impl PutTargetsInput {
14    /// <p>The name of the rule.</p>
15    pub fn rule(&self) -> ::std::option::Option<&str> {
16        self.rule.as_deref()
17    }
18    /// <p>The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
19    pub fn event_bus_name(&self) -> ::std::option::Option<&str> {
20        self.event_bus_name.as_deref()
21    }
22    /// <p>The targets to update or add to the rule.</p>
23    ///
24    /// 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()`.
25    pub fn targets(&self) -> &[crate::types::Target] {
26        self.targets.as_deref().unwrap_or_default()
27    }
28}
29impl PutTargetsInput {
30    /// Creates a new builder-style object to manufacture [`PutTargetsInput`](crate::operation::put_targets::PutTargetsInput).
31    pub fn builder() -> crate::operation::put_targets::builders::PutTargetsInputBuilder {
32        crate::operation::put_targets::builders::PutTargetsInputBuilder::default()
33    }
34}
35
36/// A builder for [`PutTargetsInput`](crate::operation::put_targets::PutTargetsInput).
37#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
38#[non_exhaustive]
39pub struct PutTargetsInputBuilder {
40    pub(crate) rule: ::std::option::Option<::std::string::String>,
41    pub(crate) event_bus_name: ::std::option::Option<::std::string::String>,
42    pub(crate) targets: ::std::option::Option<::std::vec::Vec<crate::types::Target>>,
43}
44impl PutTargetsInputBuilder {
45    /// <p>The name of the rule.</p>
46    /// This field is required.
47    pub fn rule(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
48        self.rule = ::std::option::Option::Some(input.into());
49        self
50    }
51    /// <p>The name of the rule.</p>
52    pub fn set_rule(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
53        self.rule = input;
54        self
55    }
56    /// <p>The name of the rule.</p>
57    pub fn get_rule(&self) -> &::std::option::Option<::std::string::String> {
58        &self.rule
59    }
60    /// <p>The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
61    pub fn event_bus_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
62        self.event_bus_name = ::std::option::Option::Some(input.into());
63        self
64    }
65    /// <p>The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
66    pub fn set_event_bus_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
67        self.event_bus_name = input;
68        self
69    }
70    /// <p>The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.</p>
71    pub fn get_event_bus_name(&self) -> &::std::option::Option<::std::string::String> {
72        &self.event_bus_name
73    }
74    /// Appends an item to `targets`.
75    ///
76    /// To override the contents of this collection use [`set_targets`](Self::set_targets).
77    ///
78    /// <p>The targets to update or add to the rule.</p>
79    pub fn targets(mut self, input: crate::types::Target) -> Self {
80        let mut v = self.targets.unwrap_or_default();
81        v.push(input);
82        self.targets = ::std::option::Option::Some(v);
83        self
84    }
85    /// <p>The targets to update or add to the rule.</p>
86    pub fn set_targets(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Target>>) -> Self {
87        self.targets = input;
88        self
89    }
90    /// <p>The targets to update or add to the rule.</p>
91    pub fn get_targets(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Target>> {
92        &self.targets
93    }
94    /// Consumes the builder and constructs a [`PutTargetsInput`](crate::operation::put_targets::PutTargetsInput).
95    pub fn build(self) -> ::std::result::Result<crate::operation::put_targets::PutTargetsInput, ::aws_smithy_types::error::operation::BuildError> {
96        ::std::result::Result::Ok(crate::operation::put_targets::PutTargetsInput {
97            rule: self.rule,
98            event_bus_name: self.event_bus_name,
99            targets: self.targets,
100        })
101    }
102}