scala.googleapis.storage.BucketRetentionPolicy.scala Maven / Gradle / Ivy
The newest version!
package googleapis.storage
import io.circe._
import io.circe.syntax._
final case class BucketRetentionPolicy(
/** Server-determined value that indicates the time from which policy was enforced and effective. This value is in RFC 3339 format.
*/
effectiveTime: Option[String] = None,
/** Once locked, an object retention policy cannot be modified.
*/
isLocked: Option[Boolean] = None,
/** 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.
*/
retentionPeriod: Option[Long] = None,
)
object BucketRetentionPolicy {
implicit val encoder: Encoder[BucketRetentionPolicy] = Encoder.instance { x =>
Json.obj(
"effectiveTime" := x.effectiveTime,
"isLocked" := x.isLocked,
"retentionPeriod" := x.retentionPeriod,
)
}
implicit val decoder: Decoder[BucketRetentionPolicy] = Decoder.instance { c =>
for {
v0 <- c.get[Option[String]]("effectiveTime")
v1 <- c.get[Option[Boolean]]("isLocked")
v2 <- c.get[Option[Long]]("retentionPeriod")
} yield BucketRetentionPolicy(v0, v1, v2)
}
}