aws_sdk_ssm/operation/cancel_command/
_cancel_command_input.rs

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