aws_sdk_databrew/types/
_schedule.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>Represents one or more dates and times when a job is to run.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct Schedule {
7    /// <p>The ID of the Amazon Web Services account that owns the schedule.</p>
8    pub account_id: ::std::option::Option<::std::string::String>,
9    /// <p>The Amazon Resource Name (ARN) of the user who created the schedule.</p>
10    pub created_by: ::std::option::Option<::std::string::String>,
11    /// <p>The date and time that the schedule was created.</p>
12    pub create_date: ::std::option::Option<::aws_smithy_types::DateTime>,
13    /// <p>A list of jobs to be run, according to the schedule.</p>
14    pub job_names: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
15    /// <p>The Amazon Resource Name (ARN) of the user who last modified the schedule.</p>
16    pub last_modified_by: ::std::option::Option<::std::string::String>,
17    /// <p>The date and time when the schedule was last modified.</p>
18    pub last_modified_date: ::std::option::Option<::aws_smithy_types::DateTime>,
19    /// <p>The Amazon Resource Name (ARN) of the schedule.</p>
20    pub resource_arn: ::std::option::Option<::std::string::String>,
21    /// <p>The dates and times when the job is to run. For more information, see <a href="https://docs.aws.amazon.com/databrew/latest/dg/jobs.cron.html">Cron expressions</a> in the <i>Glue DataBrew Developer Guide</i>.</p>
22    pub cron_expression: ::std::option::Option<::std::string::String>,
23    /// <p>Metadata tags that have been applied to the schedule.</p>
24    pub tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
25    /// <p>The name of the schedule.</p>
26    pub name: ::std::string::String,
27}
28impl Schedule {
29    /// <p>The ID of the Amazon Web Services account that owns the schedule.</p>
30    pub fn account_id(&self) -> ::std::option::Option<&str> {
31        self.account_id.as_deref()
32    }
33    /// <p>The Amazon Resource Name (ARN) of the user who created the schedule.</p>
34    pub fn created_by(&self) -> ::std::option::Option<&str> {
35        self.created_by.as_deref()
36    }
37    /// <p>The date and time that the schedule was created.</p>
38    pub fn create_date(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
39        self.create_date.as_ref()
40    }
41    /// <p>A list of jobs to be run, according to the schedule.</p>
42    ///
43    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.job_names.is_none()`.
44    pub fn job_names(&self) -> &[::std::string::String] {
45        self.job_names.as_deref().unwrap_or_default()
46    }
47    /// <p>The Amazon Resource Name (ARN) of the user who last modified the schedule.</p>
48    pub fn last_modified_by(&self) -> ::std::option::Option<&str> {
49        self.last_modified_by.as_deref()
50    }
51    /// <p>The date and time when the schedule was last modified.</p>
52    pub fn last_modified_date(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> {
53        self.last_modified_date.as_ref()
54    }
55    /// <p>The Amazon Resource Name (ARN) of the schedule.</p>
56    pub fn resource_arn(&self) -> ::std::option::Option<&str> {
57        self.resource_arn.as_deref()
58    }
59    /// <p>The dates and times when the job is to run. For more information, see <a href="https://docs.aws.amazon.com/databrew/latest/dg/jobs.cron.html">Cron expressions</a> in the <i>Glue DataBrew Developer Guide</i>.</p>
60    pub fn cron_expression(&self) -> ::std::option::Option<&str> {
61        self.cron_expression.as_deref()
62    }
63    /// <p>Metadata tags that have been applied to the schedule.</p>
64    pub fn tags(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, ::std::string::String>> {
65        self.tags.as_ref()
66    }
67    /// <p>The name of the schedule.</p>
68    pub fn name(&self) -> &str {
69        use std::ops::Deref;
70        self.name.deref()
71    }
72}
73impl Schedule {
74    /// Creates a new builder-style object to manufacture [`Schedule`](crate::types::Schedule).
75    pub fn builder() -> crate::types::builders::ScheduleBuilder {
76        crate::types::builders::ScheduleBuilder::default()
77    }
78}
79
80/// A builder for [`Schedule`](crate::types::Schedule).
81#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
82#[non_exhaustive]
83pub struct ScheduleBuilder {
84    pub(crate) account_id: ::std::option::Option<::std::string::String>,
85    pub(crate) created_by: ::std::option::Option<::std::string::String>,
86    pub(crate) create_date: ::std::option::Option<::aws_smithy_types::DateTime>,
87    pub(crate) job_names: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
88    pub(crate) last_modified_by: ::std::option::Option<::std::string::String>,
89    pub(crate) last_modified_date: ::std::option::Option<::aws_smithy_types::DateTime>,
90    pub(crate) resource_arn: ::std::option::Option<::std::string::String>,
91    pub(crate) cron_expression: ::std::option::Option<::std::string::String>,
92    pub(crate) tags: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>,
93    pub(crate) name: ::std::option::Option<::std::string::String>,
94}
95impl ScheduleBuilder {
96    /// <p>The ID of the Amazon Web Services account that owns the schedule.</p>
97    pub fn account_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
98        self.account_id = ::std::option::Option::Some(input.into());
99        self
100    }
101    /// <p>The ID of the Amazon Web Services account that owns the schedule.</p>
102    pub fn set_account_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
103        self.account_id = input;
104        self
105    }
106    /// <p>The ID of the Amazon Web Services account that owns the schedule.</p>
107    pub fn get_account_id(&self) -> &::std::option::Option<::std::string::String> {
108        &self.account_id
109    }
110    /// <p>The Amazon Resource Name (ARN) of the user who created the schedule.</p>
111    pub fn created_by(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
112        self.created_by = ::std::option::Option::Some(input.into());
113        self
114    }
115    /// <p>The Amazon Resource Name (ARN) of the user who created the schedule.</p>
116    pub fn set_created_by(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
117        self.created_by = input;
118        self
119    }
120    /// <p>The Amazon Resource Name (ARN) of the user who created the schedule.</p>
121    pub fn get_created_by(&self) -> &::std::option::Option<::std::string::String> {
122        &self.created_by
123    }
124    /// <p>The date and time that the schedule was created.</p>
125    pub fn create_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
126        self.create_date = ::std::option::Option::Some(input);
127        self
128    }
129    /// <p>The date and time that the schedule was created.</p>
130    pub fn set_create_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
131        self.create_date = input;
132        self
133    }
134    /// <p>The date and time that the schedule was created.</p>
135    pub fn get_create_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
136        &self.create_date
137    }
138    /// Appends an item to `job_names`.
139    ///
140    /// To override the contents of this collection use [`set_job_names`](Self::set_job_names).
141    ///
142    /// <p>A list of jobs to be run, according to the schedule.</p>
143    pub fn job_names(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
144        let mut v = self.job_names.unwrap_or_default();
145        v.push(input.into());
146        self.job_names = ::std::option::Option::Some(v);
147        self
148    }
149    /// <p>A list of jobs to be run, according to the schedule.</p>
150    pub fn set_job_names(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
151        self.job_names = input;
152        self
153    }
154    /// <p>A list of jobs to be run, according to the schedule.</p>
155    pub fn get_job_names(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
156        &self.job_names
157    }
158    /// <p>The Amazon Resource Name (ARN) of the user who last modified the schedule.</p>
159    pub fn last_modified_by(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
160        self.last_modified_by = ::std::option::Option::Some(input.into());
161        self
162    }
163    /// <p>The Amazon Resource Name (ARN) of the user who last modified the schedule.</p>
164    pub fn set_last_modified_by(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
165        self.last_modified_by = input;
166        self
167    }
168    /// <p>The Amazon Resource Name (ARN) of the user who last modified the schedule.</p>
169    pub fn get_last_modified_by(&self) -> &::std::option::Option<::std::string::String> {
170        &self.last_modified_by
171    }
172    /// <p>The date and time when the schedule was last modified.</p>
173    pub fn last_modified_date(mut self, input: ::aws_smithy_types::DateTime) -> Self {
174        self.last_modified_date = ::std::option::Option::Some(input);
175        self
176    }
177    /// <p>The date and time when the schedule was last modified.</p>
178    pub fn set_last_modified_date(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self {
179        self.last_modified_date = input;
180        self
181    }
182    /// <p>The date and time when the schedule was last modified.</p>
183    pub fn get_last_modified_date(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> {
184        &self.last_modified_date
185    }
186    /// <p>The Amazon Resource Name (ARN) of the schedule.</p>
187    pub fn resource_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
188        self.resource_arn = ::std::option::Option::Some(input.into());
189        self
190    }
191    /// <p>The Amazon Resource Name (ARN) of the schedule.</p>
192    pub fn set_resource_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
193        self.resource_arn = input;
194        self
195    }
196    /// <p>The Amazon Resource Name (ARN) of the schedule.</p>
197    pub fn get_resource_arn(&self) -> &::std::option::Option<::std::string::String> {
198        &self.resource_arn
199    }
200    /// <p>The dates and times when the job is to run. For more information, see <a href="https://docs.aws.amazon.com/databrew/latest/dg/jobs.cron.html">Cron expressions</a> in the <i>Glue DataBrew Developer Guide</i>.</p>
201    pub fn cron_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
202        self.cron_expression = ::std::option::Option::Some(input.into());
203        self
204    }
205    /// <p>The dates and times when the job is to run. For more information, see <a href="https://docs.aws.amazon.com/databrew/latest/dg/jobs.cron.html">Cron expressions</a> in the <i>Glue DataBrew Developer Guide</i>.</p>
206    pub fn set_cron_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
207        self.cron_expression = input;
208        self
209    }
210    /// <p>The dates and times when the job is to run. For more information, see <a href="https://docs.aws.amazon.com/databrew/latest/dg/jobs.cron.html">Cron expressions</a> in the <i>Glue DataBrew Developer Guide</i>.</p>
211    pub fn get_cron_expression(&self) -> &::std::option::Option<::std::string::String> {
212        &self.cron_expression
213    }
214    /// Adds a key-value pair to `tags`.
215    ///
216    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
217    ///
218    /// <p>Metadata tags that have been applied to the schedule.</p>
219    pub fn tags(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
220        let mut hash_map = self.tags.unwrap_or_default();
221        hash_map.insert(k.into(), v.into());
222        self.tags = ::std::option::Option::Some(hash_map);
223        self
224    }
225    /// <p>Metadata tags that have been applied to the schedule.</p>
226    pub fn set_tags(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
227        self.tags = input;
228        self
229    }
230    /// <p>Metadata tags that have been applied to the schedule.</p>
231    pub fn get_tags(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
232        &self.tags
233    }
234    /// <p>The name of the schedule.</p>
235    /// This field is required.
236    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
237        self.name = ::std::option::Option::Some(input.into());
238        self
239    }
240    /// <p>The name of the schedule.</p>
241    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
242        self.name = input;
243        self
244    }
245    /// <p>The name of the schedule.</p>
246    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
247        &self.name
248    }
249    /// Consumes the builder and constructs a [`Schedule`](crate::types::Schedule).
250    /// This method will fail if any of the following fields are not set:
251    /// - [`name`](crate::types::builders::ScheduleBuilder::name)
252    pub fn build(self) -> ::std::result::Result<crate::types::Schedule, ::aws_smithy_types::error::operation::BuildError> {
253        ::std::result::Result::Ok(crate::types::Schedule {
254            account_id: self.account_id,
255            created_by: self.created_by,
256            create_date: self.create_date,
257            job_names: self.job_names,
258            last_modified_by: self.last_modified_by,
259            last_modified_date: self.last_modified_date,
260            resource_arn: self.resource_arn,
261            cron_expression: self.cron_expression,
262            tags: self.tags,
263            name: self.name.ok_or_else(|| {
264                ::aws_smithy_types::error::operation::BuildError::missing_field(
265                    "name",
266                    "name was not specified but it is required when building Schedule",
267                )
268            })?,
269        })
270    }
271}