// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::put_retention_policy::_put_retention_policy_output::PutRetentionPolicyOutputBuilder;
pub use crate::operation::put_retention_policy::_put_retention_policy_input::PutRetentionPolicyInputBuilder;
/// Fluent builder constructing a request to `PutRetentionPolicy`.
///
/// <p>Sets the retention of the specified log group. With a retention policy, you can configure the number of days for which to retain log events in the specified log group.</p> <note>
/// <p>CloudWatch Logs doesn’t immediately delete log events when they reach their retention setting. It typically takes up to 72 hours after that before log events are deleted, but in rare situations might take longer.</p>
/// <p>To illustrate, imagine that you change a log group to have a longer retention setting when it contains log events that are past the expiration date, but haven’t been deleted. Those log events will take up to 72 hours to be deleted after the new retention date is reached. To make sure that log data is deleted permanently, keep a log group at its lower retention setting until 72 hours after the previous retention period ends. Alternatively, wait to change the retention setting until you confirm that the earlier log events are deleted. </p>
/// </note>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct PutRetentionPolicyFluentBuilder {
handle: std::sync::Arc<crate::client::Handle>,
inner: crate::operation::put_retention_policy::builders::PutRetentionPolicyInputBuilder,
}
impl PutRetentionPolicyFluentBuilder {
/// Creates a new `PutRetentionPolicy`.
pub(crate) fn new(handle: std::sync::Arc<crate::client::Handle>) -> Self {
Self {
handle,
inner: Default::default(),
}
}
/// Consume this builder, creating a customizable operation that can be modified before being
/// sent. The operation's inner [http::Request] can be modified as well.
pub async fn customize(
self,
) -> std::result::Result<
crate::client::customize::CustomizableOperation<
crate::operation::put_retention_policy::PutRetentionPolicy,
aws_http::retry::AwsResponseRetryClassifier,
>,
aws_smithy_http::result::SdkError<
crate::operation::put_retention_policy::PutRetentionPolicyError,
>,
> {
let handle = self.handle.clone();
let operation = self
.inner
.build()
.map_err(aws_smithy_http::result::SdkError::construction_failure)?
.make_operation(&handle.conf)
.await
.map_err(aws_smithy_http::result::SdkError::construction_failure)?;
Ok(crate::client::customize::CustomizableOperation { handle, operation })
}
/// Sends the request and returns the response.
///
/// If an error occurs, an `SdkError` will be returned with additional details that
/// can be matched against.
///
/// By default, any retryable failures will be retried twice. Retry behavior
/// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
/// set when configuring the client.
pub async fn send(
self,
) -> std::result::Result<
crate::operation::put_retention_policy::PutRetentionPolicyOutput,
aws_smithy_http::result::SdkError<
crate::operation::put_retention_policy::PutRetentionPolicyError,
>,
> {
let op = self
.inner
.build()
.map_err(aws_smithy_http::result::SdkError::construction_failure)?
.make_operation(&self.handle.conf)
.await
.map_err(aws_smithy_http::result::SdkError::construction_failure)?;
self.handle.client.call(op).await
}
/// <p>The name of the log group.</p>
pub fn log_group_name(mut self, input: impl Into<std::string::String>) -> Self {
self.inner = self.inner.log_group_name(input.into());
self
}
/// <p>The name of the log group.</p>
pub fn set_log_group_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.inner = self.inner.set_log_group_name(input);
self
}
/// <p>The number of days to retain the log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 2192, 2557, 2922, 3288, and 3653.</p>
/// <p>To set a log group so that its log events do not expire, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DeleteRetentionPolicy.html">DeleteRetentionPolicy</a>. </p>
pub fn retention_in_days(mut self, input: i32) -> Self {
self.inner = self.inner.retention_in_days(input);
self
}
/// <p>The number of days to retain the log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 2192, 2557, 2922, 3288, and 3653.</p>
/// <p>To set a log group so that its log events do not expire, use <a href="https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DeleteRetentionPolicy.html">DeleteRetentionPolicy</a>. </p>
pub fn set_retention_in_days(mut self, input: std::option::Option<i32>) -> Self {
self.inner = self.inner.set_retention_in_days(input);
self
}
}