1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p><b>\[Custom snapshot and AMI policies only\]</b> Specifies a schedule for a snapshot or AMI lifecycle policy.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Schedule {
    /// <p>The name of the schedule.</p>
    pub name: ::std::option::Option<::std::string::String>,
    /// <p>Copy all user-defined tags on a source volume to snapshots of the volume created by this policy.</p>
    pub copy_tags: ::std::option::Option<bool>,
    /// <p>The tags to apply to policy-created resources. These user-defined tags are in addition to the Amazon Web Services-added lifecycle tags.</p>
    pub tags_to_add: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
    /// <p><b>\[AMI policies and snapshot policies that target instances only\]</b> A collection of key/value pairs with values determined dynamically when the policy is executed. Keys may be any valid Amazon EC2 tag key. Values must be in one of the two following formats: <code>$(instance-id)</code> or <code>$(timestamp)</code>. Variable tags are only valid for EBS Snapshot Management – Instance policies.</p>
    pub variable_tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
    /// <p>The creation rule.</p>
    pub create_rule: ::std::option::Option<crate::types::CreateRule>,
    /// <p>The retention rule for snapshots or AMIs created by the policy.</p>
    pub retain_rule: ::std::option::Option<crate::types::RetainRule>,
    /// <p><b>\[Custom snapshot policies only\]</b> The rule for enabling fast snapshot restore.</p>
    pub fast_restore_rule: ::std::option::Option<crate::types::FastRestoreRule>,
    /// <p>Specifies a rule for copying snapshots or AMIs across regions.</p><note>
    /// <p>You can't specify cross-Region copy rules for policies that create snapshots on an Outpost. If the policy creates snapshots in a Region, then snapshots can be copied to up to three Regions or Outposts.</p>
    /// </note>
    pub cross_region_copy_rules: ::std::option::Option<::std::vec::Vec<crate::types::CrossRegionCopyRule>>,
    /// <p><b>\[Custom snapshot policies only\]</b> The rule for sharing snapshots with other Amazon Web Services accounts.</p>
    pub share_rules: ::std::option::Option<::std::vec::Vec<crate::types::ShareRule>>,
    /// <p><b>\[Custom AMI policies only\]</b> The AMI deprecation rule for the schedule.</p>
    pub deprecate_rule: ::std::option::Option<crate::types::DeprecateRule>,
    /// <p><b>\[Custom snapshot policies that target volumes only\]</b> The snapshot archiving rule for the schedule. When you specify an archiving rule, snapshots are automatically moved from the standard tier to the archive tier once the schedule's retention threshold is met. Snapshots are then retained in the archive tier for the archive retention period that you specify.</p>
    /// <p>For more information about using snapshot archiving, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-ami-policy.html#dlm-archive">Considerations for snapshot lifecycle policies</a>.</p>
    pub archive_rule: ::std::option::Option<crate::types::ArchiveRule>,
}
impl Schedule {
    /// <p>The name of the schedule.</p>
    pub fn name(&self) -> ::std::option::Option<&str> {
        self.name.as_deref()
    }
    /// <p>Copy all user-defined tags on a source volume to snapshots of the volume created by this policy.</p>
    pub fn copy_tags(&self) -> ::std::option::Option<bool> {
        self.copy_tags
    }
    /// <p>The tags to apply to policy-created resources. These user-defined tags are in addition to the Amazon Web Services-added lifecycle tags.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags_to_add.is_none()`.
    pub fn tags_to_add(&self) -> &[crate::types::Tag] {
        self.tags_to_add.as_deref().unwrap_or_default()
    }
    /// <p><b>\[AMI policies and snapshot policies that target instances only\]</b> A collection of key/value pairs with values determined dynamically when the policy is executed. Keys may be any valid Amazon EC2 tag key. Values must be in one of the two following formats: <code>$(instance-id)</code> or <code>$(timestamp)</code>. Variable tags are only valid for EBS Snapshot Management – Instance policies.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.variable_tags.is_none()`.
    pub fn variable_tags(&self) -> &[crate::types::Tag] {
        self.variable_tags.as_deref().unwrap_or_default()
    }
    /// <p>The creation rule.</p>
    pub fn create_rule(&self) -> ::std::option::Option<&crate::types::CreateRule> {
        self.create_rule.as_ref()
    }
    /// <p>The retention rule for snapshots or AMIs created by the policy.</p>
    pub fn retain_rule(&self) -> ::std::option::Option<&crate::types::RetainRule> {
        self.retain_rule.as_ref()
    }
    /// <p><b>\[Custom snapshot policies only\]</b> The rule for enabling fast snapshot restore.</p>
    pub fn fast_restore_rule(&self) -> ::std::option::Option<&crate::types::FastRestoreRule> {
        self.fast_restore_rule.as_ref()
    }
    /// <p>Specifies a rule for copying snapshots or AMIs across regions.</p><note>
    /// <p>You can't specify cross-Region copy rules for policies that create snapshots on an Outpost. If the policy creates snapshots in a Region, then snapshots can be copied to up to three Regions or Outposts.</p>
    /// </note>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.cross_region_copy_rules.is_none()`.
    pub fn cross_region_copy_rules(&self) -> &[crate::types::CrossRegionCopyRule] {
        self.cross_region_copy_rules.as_deref().unwrap_or_default()
    }
    /// <p><b>\[Custom snapshot policies only\]</b> The rule for sharing snapshots with other Amazon Web Services accounts.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.share_rules.is_none()`.
    pub fn share_rules(&self) -> &[crate::types::ShareRule] {
        self.share_rules.as_deref().unwrap_or_default()
    }
    /// <p><b>\[Custom AMI policies only\]</b> The AMI deprecation rule for the schedule.</p>
    pub fn deprecate_rule(&self) -> ::std::option::Option<&crate::types::DeprecateRule> {
        self.deprecate_rule.as_ref()
    }
    /// <p><b>\[Custom snapshot policies that target volumes only\]</b> The snapshot archiving rule for the schedule. When you specify an archiving rule, snapshots are automatically moved from the standard tier to the archive tier once the schedule's retention threshold is met. Snapshots are then retained in the archive tier for the archive retention period that you specify.</p>
    /// <p>For more information about using snapshot archiving, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-ami-policy.html#dlm-archive">Considerations for snapshot lifecycle policies</a>.</p>
    pub fn archive_rule(&self) -> ::std::option::Option<&crate::types::ArchiveRule> {
        self.archive_rule.as_ref()
    }
}
impl Schedule {
    /// Creates a new builder-style object to manufacture [`Schedule`](crate::types::Schedule).
    pub fn builder() -> crate::types::builders::ScheduleBuilder {
        crate::types::builders::ScheduleBuilder::default()
    }
}

/// A builder for [`Schedule`](crate::types::Schedule).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct ScheduleBuilder {
    pub(crate) name: ::std::option::Option<::std::string::String>,
    pub(crate) copy_tags: ::std::option::Option<bool>,
    pub(crate) tags_to_add: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
    pub(crate) variable_tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
    pub(crate) create_rule: ::std::option::Option<crate::types::CreateRule>,
    pub(crate) retain_rule: ::std::option::Option<crate::types::RetainRule>,
    pub(crate) fast_restore_rule: ::std::option::Option<crate::types::FastRestoreRule>,
    pub(crate) cross_region_copy_rules: ::std::option::Option<::std::vec::Vec<crate::types::CrossRegionCopyRule>>,
    pub(crate) share_rules: ::std::option::Option<::std::vec::Vec<crate::types::ShareRule>>,
    pub(crate) deprecate_rule: ::std::option::Option<crate::types::DeprecateRule>,
    pub(crate) archive_rule: ::std::option::Option<crate::types::ArchiveRule>,
}
impl ScheduleBuilder {
    /// <p>The name of the schedule.</p>
    pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the schedule.</p>
    pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.name = input;
        self
    }
    /// <p>The name of the schedule.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.name
    }
    /// <p>Copy all user-defined tags on a source volume to snapshots of the volume created by this policy.</p>
    pub fn copy_tags(mut self, input: bool) -> Self {
        self.copy_tags = ::std::option::Option::Some(input);
        self
    }
    /// <p>Copy all user-defined tags on a source volume to snapshots of the volume created by this policy.</p>
    pub fn set_copy_tags(mut self, input: ::std::option::Option<bool>) -> Self {
        self.copy_tags = input;
        self
    }
    /// <p>Copy all user-defined tags on a source volume to snapshots of the volume created by this policy.</p>
    pub fn get_copy_tags(&self) -> &::std::option::Option<bool> {
        &self.copy_tags
    }
    /// Appends an item to `tags_to_add`.
    ///
    /// To override the contents of this collection use [`set_tags_to_add`](Self::set_tags_to_add).
    ///
    /// <p>The tags to apply to policy-created resources. These user-defined tags are in addition to the Amazon Web Services-added lifecycle tags.</p>
    pub fn tags_to_add(mut self, input: crate::types::Tag) -> Self {
        let mut v = self.tags_to_add.unwrap_or_default();
        v.push(input);
        self.tags_to_add = ::std::option::Option::Some(v);
        self
    }
    /// <p>The tags to apply to policy-created resources. These user-defined tags are in addition to the Amazon Web Services-added lifecycle tags.</p>
    pub fn set_tags_to_add(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
        self.tags_to_add = input;
        self
    }
    /// <p>The tags to apply to policy-created resources. These user-defined tags are in addition to the Amazon Web Services-added lifecycle tags.</p>
    pub fn get_tags_to_add(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
        &self.tags_to_add
    }
    /// Appends an item to `variable_tags`.
    ///
    /// To override the contents of this collection use [`set_variable_tags`](Self::set_variable_tags).
    ///
    /// <p><b>\[AMI policies and snapshot policies that target instances only\]</b> A collection of key/value pairs with values determined dynamically when the policy is executed. Keys may be any valid Amazon EC2 tag key. Values must be in one of the two following formats: <code>$(instance-id)</code> or <code>$(timestamp)</code>. Variable tags are only valid for EBS Snapshot Management – Instance policies.</p>
    pub fn variable_tags(mut self, input: crate::types::Tag) -> Self {
        let mut v = self.variable_tags.unwrap_or_default();
        v.push(input);
        self.variable_tags = ::std::option::Option::Some(v);
        self
    }
    /// <p><b>\[AMI policies and snapshot policies that target instances only\]</b> A collection of key/value pairs with values determined dynamically when the policy is executed. Keys may be any valid Amazon EC2 tag key. Values must be in one of the two following formats: <code>$(instance-id)</code> or <code>$(timestamp)</code>. Variable tags are only valid for EBS Snapshot Management – Instance policies.</p>
    pub fn set_variable_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
        self.variable_tags = input;
        self
    }
    /// <p><b>\[AMI policies and snapshot policies that target instances only\]</b> A collection of key/value pairs with values determined dynamically when the policy is executed. Keys may be any valid Amazon EC2 tag key. Values must be in one of the two following formats: <code>$(instance-id)</code> or <code>$(timestamp)</code>. Variable tags are only valid for EBS Snapshot Management – Instance policies.</p>
    pub fn get_variable_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
        &self.variable_tags
    }
    /// <p>The creation rule.</p>
    pub fn create_rule(mut self, input: crate::types::CreateRule) -> Self {
        self.create_rule = ::std::option::Option::Some(input);
        self
    }
    /// <p>The creation rule.</p>
    pub fn set_create_rule(mut self, input: ::std::option::Option<crate::types::CreateRule>) -> Self {
        self.create_rule = input;
        self
    }
    /// <p>The creation rule.</p>
    pub fn get_create_rule(&self) -> &::std::option::Option<crate::types::CreateRule> {
        &self.create_rule
    }
    /// <p>The retention rule for snapshots or AMIs created by the policy.</p>
    pub fn retain_rule(mut self, input: crate::types::RetainRule) -> Self {
        self.retain_rule = ::std::option::Option::Some(input);
        self
    }
    /// <p>The retention rule for snapshots or AMIs created by the policy.</p>
    pub fn set_retain_rule(mut self, input: ::std::option::Option<crate::types::RetainRule>) -> Self {
        self.retain_rule = input;
        self
    }
    /// <p>The retention rule for snapshots or AMIs created by the policy.</p>
    pub fn get_retain_rule(&self) -> &::std::option::Option<crate::types::RetainRule> {
        &self.retain_rule
    }
    /// <p><b>\[Custom snapshot policies only\]</b> The rule for enabling fast snapshot restore.</p>
    pub fn fast_restore_rule(mut self, input: crate::types::FastRestoreRule) -> Self {
        self.fast_restore_rule = ::std::option::Option::Some(input);
        self
    }
    /// <p><b>\[Custom snapshot policies only\]</b> The rule for enabling fast snapshot restore.</p>
    pub fn set_fast_restore_rule(mut self, input: ::std::option::Option<crate::types::FastRestoreRule>) -> Self {
        self.fast_restore_rule = input;
        self
    }
    /// <p><b>\[Custom snapshot policies only\]</b> The rule for enabling fast snapshot restore.</p>
    pub fn get_fast_restore_rule(&self) -> &::std::option::Option<crate::types::FastRestoreRule> {
        &self.fast_restore_rule
    }
    /// Appends an item to `cross_region_copy_rules`.
    ///
    /// To override the contents of this collection use [`set_cross_region_copy_rules`](Self::set_cross_region_copy_rules).
    ///
    /// <p>Specifies a rule for copying snapshots or AMIs across regions.</p><note>
    /// <p>You can't specify cross-Region copy rules for policies that create snapshots on an Outpost. If the policy creates snapshots in a Region, then snapshots can be copied to up to three Regions or Outposts.</p>
    /// </note>
    pub fn cross_region_copy_rules(mut self, input: crate::types::CrossRegionCopyRule) -> Self {
        let mut v = self.cross_region_copy_rules.unwrap_or_default();
        v.push(input);
        self.cross_region_copy_rules = ::std::option::Option::Some(v);
        self
    }
    /// <p>Specifies a rule for copying snapshots or AMIs across regions.</p><note>
    /// <p>You can't specify cross-Region copy rules for policies that create snapshots on an Outpost. If the policy creates snapshots in a Region, then snapshots can be copied to up to three Regions or Outposts.</p>
    /// </note>
    pub fn set_cross_region_copy_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::CrossRegionCopyRule>>) -> Self {
        self.cross_region_copy_rules = input;
        self
    }
    /// <p>Specifies a rule for copying snapshots or AMIs across regions.</p><note>
    /// <p>You can't specify cross-Region copy rules for policies that create snapshots on an Outpost. If the policy creates snapshots in a Region, then snapshots can be copied to up to three Regions or Outposts.</p>
    /// </note>
    pub fn get_cross_region_copy_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::CrossRegionCopyRule>> {
        &self.cross_region_copy_rules
    }
    /// Appends an item to `share_rules`.
    ///
    /// To override the contents of this collection use [`set_share_rules`](Self::set_share_rules).
    ///
    /// <p><b>\[Custom snapshot policies only\]</b> The rule for sharing snapshots with other Amazon Web Services accounts.</p>
    pub fn share_rules(mut self, input: crate::types::ShareRule) -> Self {
        let mut v = self.share_rules.unwrap_or_default();
        v.push(input);
        self.share_rules = ::std::option::Option::Some(v);
        self
    }
    /// <p><b>\[Custom snapshot policies only\]</b> The rule for sharing snapshots with other Amazon Web Services accounts.</p>
    pub fn set_share_rules(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::ShareRule>>) -> Self {
        self.share_rules = input;
        self
    }
    /// <p><b>\[Custom snapshot policies only\]</b> The rule for sharing snapshots with other Amazon Web Services accounts.</p>
    pub fn get_share_rules(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::ShareRule>> {
        &self.share_rules
    }
    /// <p><b>\[Custom AMI policies only\]</b> The AMI deprecation rule for the schedule.</p>
    pub fn deprecate_rule(mut self, input: crate::types::DeprecateRule) -> Self {
        self.deprecate_rule = ::std::option::Option::Some(input);
        self
    }
    /// <p><b>\[Custom AMI policies only\]</b> The AMI deprecation rule for the schedule.</p>
    pub fn set_deprecate_rule(mut self, input: ::std::option::Option<crate::types::DeprecateRule>) -> Self {
        self.deprecate_rule = input;
        self
    }
    /// <p><b>\[Custom AMI policies only\]</b> The AMI deprecation rule for the schedule.</p>
    pub fn get_deprecate_rule(&self) -> &::std::option::Option<crate::types::DeprecateRule> {
        &self.deprecate_rule
    }
    /// <p><b>\[Custom snapshot policies that target volumes only\]</b> The snapshot archiving rule for the schedule. When you specify an archiving rule, snapshots are automatically moved from the standard tier to the archive tier once the schedule's retention threshold is met. Snapshots are then retained in the archive tier for the archive retention period that you specify.</p>
    /// <p>For more information about using snapshot archiving, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-ami-policy.html#dlm-archive">Considerations for snapshot lifecycle policies</a>.</p>
    pub fn archive_rule(mut self, input: crate::types::ArchiveRule) -> Self {
        self.archive_rule = ::std::option::Option::Some(input);
        self
    }
    /// <p><b>\[Custom snapshot policies that target volumes only\]</b> The snapshot archiving rule for the schedule. When you specify an archiving rule, snapshots are automatically moved from the standard tier to the archive tier once the schedule's retention threshold is met. Snapshots are then retained in the archive tier for the archive retention period that you specify.</p>
    /// <p>For more information about using snapshot archiving, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-ami-policy.html#dlm-archive">Considerations for snapshot lifecycle policies</a>.</p>
    pub fn set_archive_rule(mut self, input: ::std::option::Option<crate::types::ArchiveRule>) -> Self {
        self.archive_rule = input;
        self
    }
    /// <p><b>\[Custom snapshot policies that target volumes only\]</b> The snapshot archiving rule for the schedule. When you specify an archiving rule, snapshots are automatically moved from the standard tier to the archive tier once the schedule's retention threshold is met. Snapshots are then retained in the archive tier for the archive retention period that you specify.</p>
    /// <p>For more information about using snapshot archiving, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/snapshot-ami-policy.html#dlm-archive">Considerations for snapshot lifecycle policies</a>.</p>
    pub fn get_archive_rule(&self) -> &::std::option::Option<crate::types::ArchiveRule> {
        &self.archive_rule
    }
    /// Consumes the builder and constructs a [`Schedule`](crate::types::Schedule).
    pub fn build(self) -> crate::types::Schedule {
        crate::types::Schedule {
            name: self.name,
            copy_tags: self.copy_tags,
            tags_to_add: self.tags_to_add,
            variable_tags: self.variable_tags,
            create_rule: self.create_rule,
            retain_rule: self.retain_rule,
            fast_restore_rule: self.fast_restore_rule,
            cross_region_copy_rules: self.cross_region_copy_rules,
            share_rules: self.share_rules,
            deprecate_rule: self.deprecate_rule,
            archive_rule: self.archive_rule,
        }
    }
}