aws_sdk_snowdevicemanagement/operation/create_task/
_create_task_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 CreateTaskInput {
6    /// <p>A list of managed device IDs.</p>
7    pub targets: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
8    /// <p>The task to be performed. Only one task is executed on a device at a time.</p>
9    pub command: ::std::option::Option<crate::types::Command>,
10    /// <p>A description of the task and its targets.</p>
11    pub description: ::std::option::Option<::std::string::String>,
12    /// <p>Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, such as by purpose, owner, or environment.</p>
13    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
14    /// <p>A token ensuring that the action is called only once with the specified details.</p>
15    pub client_token: ::std::option::Option<::std::string::String>,
16}
17impl CreateTaskInput {
18    /// <p>A list of managed device IDs.</p>
19    ///
20    /// 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()`.
21    pub fn targets(&self) -> &[::std::string::String] {
22        self.targets.as_deref().unwrap_or_default()
23    }
24    /// <p>The task to be performed. Only one task is executed on a device at a time.</p>
25    pub fn command(&self) -> ::std::option::Option<&crate::types::Command> {
26        self.command.as_ref()
27    }
28    /// <p>A description of the task and its targets.</p>
29    pub fn description(&self) -> ::std::option::Option<&str> {
30        self.description.as_deref()
31    }
32    /// <p>Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, such as by purpose, owner, or environment.</p>
33    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
34        self.tags.as_ref()
35    }
36    /// <p>A token ensuring that the action is called only once with the specified details.</p>
37    pub fn client_token(&self) -> ::std::option::Option<&str> {
38        self.client_token.as_deref()
39    }
40}
41impl CreateTaskInput {
42    /// Creates a new builder-style object to manufacture [`CreateTaskInput`](crate::operation::create_task::CreateTaskInput).
43    pub fn builder() -> crate::operation::create_task::builders::CreateTaskInputBuilder {
44        crate::operation::create_task::builders::CreateTaskInputBuilder::default()
45    }
46}
47
48/// A builder for [`CreateTaskInput`](crate::operation::create_task::CreateTaskInput).
49#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
50#[non_exhaustive]
51pub struct CreateTaskInputBuilder {
52    pub(crate) targets: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
53    pub(crate) command: ::std::option::Option<crate::types::Command>,
54    pub(crate) description: ::std::option::Option<::std::string::String>,
55    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
56    pub(crate) client_token: ::std::option::Option<::std::string::String>,
57}
58impl CreateTaskInputBuilder {
59    /// Appends an item to `targets`.
60    ///
61    /// To override the contents of this collection use [`set_targets`](Self::set_targets).
62    ///
63    /// <p>A list of managed device IDs.</p>
64    pub fn targets(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
65        let mut v = self.targets.unwrap_or_default();
66        v.push(input.into());
67        self.targets = ::std::option::Option::Some(v);
68        self
69    }
70    /// <p>A list of managed device IDs.</p>
71    pub fn set_targets(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
72        self.targets = input;
73        self
74    }
75    /// <p>A list of managed device IDs.</p>
76    pub fn get_targets(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
77        &self.targets
78    }
79    /// <p>The task to be performed. Only one task is executed on a device at a time.</p>
80    /// This field is required.
81    pub fn command(mut self, input: crate::types::Command) -> Self {
82        self.command = ::std::option::Option::Some(input);
83        self
84    }
85    /// <p>The task to be performed. Only one task is executed on a device at a time.</p>
86    pub fn set_command(mut self, input: ::std::option::Option<crate::types::Command>) -> Self {
87        self.command = input;
88        self
89    }
90    /// <p>The task to be performed. Only one task is executed on a device at a time.</p>
91    pub fn get_command(&self) -> &::std::option::Option<crate::types::Command> {
92        &self.command
93    }
94    /// <p>A description of the task and its targets.</p>
95    pub fn description(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
96        self.description = ::std::option::Option::Some(input.into());
97        self
98    }
99    /// <p>A description of the task and its targets.</p>
100    pub fn set_description(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
101        self.description = input;
102        self
103    }
104    /// <p>A description of the task and its targets.</p>
105    pub fn get_description(&self) -> &::std::option::Option<::std::string::String> {
106        &self.description
107    }
108    /// Adds a key-value pair to `tags`.
109    ///
110    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
111    ///
112    /// <p>Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, such as by purpose, owner, or environment.</p>
113    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
114        let mut hash_map = self.tags.unwrap_or_default();
115        hash_map.insert(k.into(), v.into());
116        self.tags = ::std::option::Option::Some(hash_map);
117        self
118    }
119    /// <p>Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, such as by purpose, owner, or environment.</p>
120    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
121        self.tags = input;
122        self
123    }
124    /// <p>Optional metadata that you assign to a resource. You can use tags to categorize a resource in different ways, such as by purpose, owner, or environment.</p>
125    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
126        &self.tags
127    }
128    /// <p>A token ensuring that the action is called only once with the specified details.</p>
129    pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
130        self.client_token = ::std::option::Option::Some(input.into());
131        self
132    }
133    /// <p>A token ensuring that the action is called only once with the specified details.</p>
134    pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
135        self.client_token = input;
136        self
137    }
138    /// <p>A token ensuring that the action is called only once with the specified details.</p>
139    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
140        &self.client_token
141    }
142    /// Consumes the builder and constructs a [`CreateTaskInput`](crate::operation::create_task::CreateTaskInput).
143    pub fn build(self) -> ::std::result::Result<crate::operation::create_task::CreateTaskInput, ::aws_smithy_types::error::operation::BuildError> {
144        ::std::result::Result::Ok(crate::operation::create_task::CreateTaskInput {
145            targets: self.targets,
146            command: self.command,
147            description: self.description,
148            tags: self.tags,
149            client_token: self.client_token,
150        })
151    }
152}