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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p><b>\[Custom snapshot and AMI policies only\]</b> Specifies when the policy should create snapshots or AMIs.</p><note>
/// <ul>
/// <li>
/// <p>You must specify either <b>CronExpression</b>, or <b>Interval</b>, <b>IntervalUnit</b>, and <b>Times</b>.</p></li>
/// <li>
/// <p>If you need to specify an <a href="https://docs.aws.amazon.com/dlm/latest/APIReference/API_ArchiveRule.html">ArchiveRule</a> for the schedule, then you must specify a creation frequency of at least 28 days.</p></li>
/// </ul>
/// </note>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct CreateRule {
/// <p><b>\[Custom snapshot policies only\]</b> Specifies the destination for snapshots created by the policy. To create snapshots in the same Region as the source resource, specify <code>CLOUD</code>. To create snapshots on the same Outpost as the source resource, specify <code>OUTPOST_LOCAL</code>. If you omit this parameter, <code>CLOUD</code> is used by default.</p>
/// <p>If the policy targets resources in an Amazon Web Services Region, then you must create snapshots in the same Region as the source resource. If the policy targets resources on an Outpost, then you can create snapshots on the same Outpost as the source resource, or in the Region of that Outpost.</p>
pub location: ::std::option::Option<crate::types::LocationValues>,
/// <p>The interval between snapshots. The supported values are 1, 2, 3, 4, 6, 8, 12, and 24.</p>
pub interval: ::std::option::Option<i32>,
/// <p>The interval unit.</p>
pub interval_unit: ::std::option::Option<crate::types::IntervalUnitValues>,
/// <p>The time, in UTC, to start the operation. The supported format is hh:mm.</p>
/// <p>The operation occurs within a one-hour window following the specified time. If you do not specify a time, Amazon Data Lifecycle Manager selects a time within the next 24 hours.</p>
pub times: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
/// <p>The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions">Cron expressions</a> in the <i>Amazon CloudWatch User Guide</i>.</p>
pub cron_expression: ::std::option::Option<::std::string::String>,
/// <p><b>\[Custom snapshot policies that target instances only\]</b> Specifies pre and/or post scripts for a snapshot lifecycle policy that targets instances. This is useful for creating application-consistent snapshots, or for performing specific administrative tasks before or after Amazon Data Lifecycle Manager initiates snapshot creation.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/automate-app-consistent-backups.html">Automating application-consistent snapshots with pre and post scripts</a>.</p>
pub scripts: ::std::option::Option<::std::vec::Vec<crate::types::Script>>,
}
impl CreateRule {
/// <p><b>\[Custom snapshot policies only\]</b> Specifies the destination for snapshots created by the policy. To create snapshots in the same Region as the source resource, specify <code>CLOUD</code>. To create snapshots on the same Outpost as the source resource, specify <code>OUTPOST_LOCAL</code>. If you omit this parameter, <code>CLOUD</code> is used by default.</p>
/// <p>If the policy targets resources in an Amazon Web Services Region, then you must create snapshots in the same Region as the source resource. If the policy targets resources on an Outpost, then you can create snapshots on the same Outpost as the source resource, or in the Region of that Outpost.</p>
pub fn location(&self) -> ::std::option::Option<&crate::types::LocationValues> {
self.location.as_ref()
}
/// <p>The interval between snapshots. The supported values are 1, 2, 3, 4, 6, 8, 12, and 24.</p>
pub fn interval(&self) -> ::std::option::Option<i32> {
self.interval
}
/// <p>The interval unit.</p>
pub fn interval_unit(&self) -> ::std::option::Option<&crate::types::IntervalUnitValues> {
self.interval_unit.as_ref()
}
/// <p>The time, in UTC, to start the operation. The supported format is hh:mm.</p>
/// <p>The operation occurs within a one-hour window following the specified time. If you do not specify a time, Amazon Data Lifecycle Manager selects a time within the next 24 hours.</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 `.times.is_none()`.
pub fn times(&self) -> &[::std::string::String] {
self.times.as_deref().unwrap_or_default()
}
/// <p>The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions">Cron expressions</a> in the <i>Amazon CloudWatch User Guide</i>.</p>
pub fn cron_expression(&self) -> ::std::option::Option<&str> {
self.cron_expression.as_deref()
}
/// <p><b>\[Custom snapshot policies that target instances only\]</b> Specifies pre and/or post scripts for a snapshot lifecycle policy that targets instances. This is useful for creating application-consistent snapshots, or for performing specific administrative tasks before or after Amazon Data Lifecycle Manager initiates snapshot creation.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/automate-app-consistent-backups.html">Automating application-consistent snapshots with pre and post scripts</a>.</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 `.scripts.is_none()`.
pub fn scripts(&self) -> &[crate::types::Script] {
self.scripts.as_deref().unwrap_or_default()
}
}
impl CreateRule {
/// Creates a new builder-style object to manufacture [`CreateRule`](crate::types::CreateRule).
pub fn builder() -> crate::types::builders::CreateRuleBuilder {
crate::types::builders::CreateRuleBuilder::default()
}
}
/// A builder for [`CreateRule`](crate::types::CreateRule).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct CreateRuleBuilder {
pub(crate) location: ::std::option::Option<crate::types::LocationValues>,
pub(crate) interval: ::std::option::Option<i32>,
pub(crate) interval_unit: ::std::option::Option<crate::types::IntervalUnitValues>,
pub(crate) times: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
pub(crate) cron_expression: ::std::option::Option<::std::string::String>,
pub(crate) scripts: ::std::option::Option<::std::vec::Vec<crate::types::Script>>,
}
impl CreateRuleBuilder {
/// <p><b>\[Custom snapshot policies only\]</b> Specifies the destination for snapshots created by the policy. To create snapshots in the same Region as the source resource, specify <code>CLOUD</code>. To create snapshots on the same Outpost as the source resource, specify <code>OUTPOST_LOCAL</code>. If you omit this parameter, <code>CLOUD</code> is used by default.</p>
/// <p>If the policy targets resources in an Amazon Web Services Region, then you must create snapshots in the same Region as the source resource. If the policy targets resources on an Outpost, then you can create snapshots on the same Outpost as the source resource, or in the Region of that Outpost.</p>
pub fn location(mut self, input: crate::types::LocationValues) -> Self {
self.location = ::std::option::Option::Some(input);
self
}
/// <p><b>\[Custom snapshot policies only\]</b> Specifies the destination for snapshots created by the policy. To create snapshots in the same Region as the source resource, specify <code>CLOUD</code>. To create snapshots on the same Outpost as the source resource, specify <code>OUTPOST_LOCAL</code>. If you omit this parameter, <code>CLOUD</code> is used by default.</p>
/// <p>If the policy targets resources in an Amazon Web Services Region, then you must create snapshots in the same Region as the source resource. If the policy targets resources on an Outpost, then you can create snapshots on the same Outpost as the source resource, or in the Region of that Outpost.</p>
pub fn set_location(mut self, input: ::std::option::Option<crate::types::LocationValues>) -> Self {
self.location = input;
self
}
/// <p><b>\[Custom snapshot policies only\]</b> Specifies the destination for snapshots created by the policy. To create snapshots in the same Region as the source resource, specify <code>CLOUD</code>. To create snapshots on the same Outpost as the source resource, specify <code>OUTPOST_LOCAL</code>. If you omit this parameter, <code>CLOUD</code> is used by default.</p>
/// <p>If the policy targets resources in an Amazon Web Services Region, then you must create snapshots in the same Region as the source resource. If the policy targets resources on an Outpost, then you can create snapshots on the same Outpost as the source resource, or in the Region of that Outpost.</p>
pub fn get_location(&self) -> &::std::option::Option<crate::types::LocationValues> {
&self.location
}
/// <p>The interval between snapshots. The supported values are 1, 2, 3, 4, 6, 8, 12, and 24.</p>
pub fn interval(mut self, input: i32) -> Self {
self.interval = ::std::option::Option::Some(input);
self
}
/// <p>The interval between snapshots. The supported values are 1, 2, 3, 4, 6, 8, 12, and 24.</p>
pub fn set_interval(mut self, input: ::std::option::Option<i32>) -> Self {
self.interval = input;
self
}
/// <p>The interval between snapshots. The supported values are 1, 2, 3, 4, 6, 8, 12, and 24.</p>
pub fn get_interval(&self) -> &::std::option::Option<i32> {
&self.interval
}
/// <p>The interval unit.</p>
pub fn interval_unit(mut self, input: crate::types::IntervalUnitValues) -> Self {
self.interval_unit = ::std::option::Option::Some(input);
self
}
/// <p>The interval unit.</p>
pub fn set_interval_unit(mut self, input: ::std::option::Option<crate::types::IntervalUnitValues>) -> Self {
self.interval_unit = input;
self
}
/// <p>The interval unit.</p>
pub fn get_interval_unit(&self) -> &::std::option::Option<crate::types::IntervalUnitValues> {
&self.interval_unit
}
/// Appends an item to `times`.
///
/// To override the contents of this collection use [`set_times`](Self::set_times).
///
/// <p>The time, in UTC, to start the operation. The supported format is hh:mm.</p>
/// <p>The operation occurs within a one-hour window following the specified time. If you do not specify a time, Amazon Data Lifecycle Manager selects a time within the next 24 hours.</p>
pub fn times(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.times.unwrap_or_default();
v.push(input.into());
self.times = ::std::option::Option::Some(v);
self
}
/// <p>The time, in UTC, to start the operation. The supported format is hh:mm.</p>
/// <p>The operation occurs within a one-hour window following the specified time. If you do not specify a time, Amazon Data Lifecycle Manager selects a time within the next 24 hours.</p>
pub fn set_times(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.times = input;
self
}
/// <p>The time, in UTC, to start the operation. The supported format is hh:mm.</p>
/// <p>The operation occurs within a one-hour window following the specified time. If you do not specify a time, Amazon Data Lifecycle Manager selects a time within the next 24 hours.</p>
pub fn get_times(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.times
}
/// <p>The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions">Cron expressions</a> in the <i>Amazon CloudWatch User Guide</i>.</p>
pub fn cron_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.cron_expression = ::std::option::Option::Some(input.into());
self
}
/// <p>The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions">Cron expressions</a> in the <i>Amazon CloudWatch User Guide</i>.</p>
pub fn set_cron_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.cron_expression = input;
self
}
/// <p>The schedule, as a Cron expression. The schedule interval must be between 1 hour and 1 year. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions">Cron expressions</a> in the <i>Amazon CloudWatch User Guide</i>.</p>
pub fn get_cron_expression(&self) -> &::std::option::Option<::std::string::String> {
&self.cron_expression
}
/// Appends an item to `scripts`.
///
/// To override the contents of this collection use [`set_scripts`](Self::set_scripts).
///
/// <p><b>\[Custom snapshot policies that target instances only\]</b> Specifies pre and/or post scripts for a snapshot lifecycle policy that targets instances. This is useful for creating application-consistent snapshots, or for performing specific administrative tasks before or after Amazon Data Lifecycle Manager initiates snapshot creation.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/automate-app-consistent-backups.html">Automating application-consistent snapshots with pre and post scripts</a>.</p>
pub fn scripts(mut self, input: crate::types::Script) -> Self {
let mut v = self.scripts.unwrap_or_default();
v.push(input);
self.scripts = ::std::option::Option::Some(v);
self
}
/// <p><b>\[Custom snapshot policies that target instances only\]</b> Specifies pre and/or post scripts for a snapshot lifecycle policy that targets instances. This is useful for creating application-consistent snapshots, or for performing specific administrative tasks before or after Amazon Data Lifecycle Manager initiates snapshot creation.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/automate-app-consistent-backups.html">Automating application-consistent snapshots with pre and post scripts</a>.</p>
pub fn set_scripts(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Script>>) -> Self {
self.scripts = input;
self
}
/// <p><b>\[Custom snapshot policies that target instances only\]</b> Specifies pre and/or post scripts for a snapshot lifecycle policy that targets instances. This is useful for creating application-consistent snapshots, or for performing specific administrative tasks before or after Amazon Data Lifecycle Manager initiates snapshot creation.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/automate-app-consistent-backups.html">Automating application-consistent snapshots with pre and post scripts</a>.</p>
pub fn get_scripts(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Script>> {
&self.scripts
}
/// Consumes the builder and constructs a [`CreateRule`](crate::types::CreateRule).
pub fn build(self) -> crate::types::CreateRule {
crate::types::CreateRule {
location: self.location,
interval: self.interval,
interval_unit: self.interval_unit,
times: self.times,
cron_expression: self.cron_expression,
scripts: self.scripts,
}
}
}