use serde::{Deserialize, Serialize}; /*
                                      * Cloud Storage JSON API
                                      *
                                      * Stores and retrieves potentially large, immutable data objects.
                                      *
                                      * The version of the OpenAPI document: v1
                                      *
                                      * Generated by: https://openapi-generator.tech
                                      */

use crate::google_rest_apis::storage_v1::models;

/// BucketRetentionPolicy : The bucket's retention policy. The retention policy enforces a minimum retention time for all objects contained in the bucket, based on their creation time. Any attempt to overwrite or delete objects younger than the retention period will result in a PERMISSION_DENIED error. An unlocked retention policy can be modified or removed from the bucket via a storage.buckets.update operation. A locked retention policy cannot be removed or shortened in duration for the lifetime of the bucket. Attempting to remove or decrease period of a locked retention policy will result in a PERMISSION_DENIED error.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct BucketRetentionPolicy {
    /// Server-determined value that indicates the time from which policy was enforced and effective. This value is in RFC 3339 format.
    #[serde(rename = "effectiveTime", skip_serializing_if = "Option::is_none")]
    pub effective_time: Option<String>,
    /// Once locked, an object retention policy cannot be modified.
    #[serde(rename = "isLocked", skip_serializing_if = "Option::is_none")]
    pub is_locked: Option<bool>,
    /// The duration in seconds that objects need to be retained. Retention duration must be greater than zero and less than 100 years. Note that enforcement of retention periods less than a day is not guaranteed. Such periods should only be used for testing purposes.
    #[serde(rename = "retentionPeriod", skip_serializing_if = "Option::is_none")]
    pub retention_period: Option<String>,
}

impl BucketRetentionPolicy {
    /// The bucket's retention policy. The retention policy enforces a minimum retention time for all objects contained in the bucket, based on their creation time. Any attempt to overwrite or delete objects younger than the retention period will result in a PERMISSION_DENIED error. An unlocked retention policy can be modified or removed from the bucket via a storage.buckets.update operation. A locked retention policy cannot be removed or shortened in duration for the lifetime of the bucket. Attempting to remove or decrease period of a locked retention policy will result in a PERMISSION_DENIED error.
    pub fn new() -> BucketRetentionPolicy {
        BucketRetentionPolicy {
            effective_time: None,
            is_locked: None,
            retention_period: None,
        }
    }
}
