{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.S3.Types.Transition where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.TransitionStorageClass
data Transition = Transition'
{
Transition -> Maybe Int
days :: Prelude.Maybe Prelude.Int,
Transition -> Maybe ISO8601
date :: Prelude.Maybe Core.ISO8601,
Transition -> Maybe TransitionStorageClass
storageClass :: Prelude.Maybe TransitionStorageClass
}
deriving (Transition -> Transition -> Bool
(Transition -> Transition -> Bool)
-> (Transition -> Transition -> Bool) -> Eq Transition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Transition -> Transition -> Bool
$c/= :: Transition -> Transition -> Bool
== :: Transition -> Transition -> Bool
$c== :: Transition -> Transition -> Bool
Prelude.Eq, ReadPrec [Transition]
ReadPrec Transition
Int -> ReadS Transition
ReadS [Transition]
(Int -> ReadS Transition)
-> ReadS [Transition]
-> ReadPrec Transition
-> ReadPrec [Transition]
-> Read Transition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Transition]
$creadListPrec :: ReadPrec [Transition]
readPrec :: ReadPrec Transition
$creadPrec :: ReadPrec Transition
readList :: ReadS [Transition]
$creadList :: ReadS [Transition]
readsPrec :: Int -> ReadS Transition
$creadsPrec :: Int -> ReadS Transition
Prelude.Read, Int -> Transition -> ShowS
[Transition] -> ShowS
Transition -> String
(Int -> Transition -> ShowS)
-> (Transition -> String)
-> ([Transition] -> ShowS)
-> Show Transition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Transition] -> ShowS
$cshowList :: [Transition] -> ShowS
show :: Transition -> String
$cshow :: Transition -> String
showsPrec :: Int -> Transition -> ShowS
$cshowsPrec :: Int -> Transition -> ShowS
Prelude.Show, (forall x. Transition -> Rep Transition x)
-> (forall x. Rep Transition x -> Transition) -> Generic Transition
forall x. Rep Transition x -> Transition
forall x. Transition -> Rep Transition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Transition x -> Transition
$cfrom :: forall x. Transition -> Rep Transition x
Prelude.Generic)
newTransition ::
Transition
newTransition :: Transition
newTransition =
Transition' :: Maybe Int
-> Maybe ISO8601 -> Maybe TransitionStorageClass -> Transition
Transition'
{ $sel:days:Transition' :: Maybe Int
days = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:date:Transition' :: Maybe ISO8601
date = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
$sel:storageClass:Transition' :: Maybe TransitionStorageClass
storageClass = Maybe TransitionStorageClass
forall a. Maybe a
Prelude.Nothing
}
transition_days :: Lens.Lens' Transition (Prelude.Maybe Prelude.Int)
transition_days :: (Maybe Int -> f (Maybe Int)) -> Transition -> f Transition
transition_days = (Transition -> Maybe Int)
-> (Transition -> Maybe Int -> Transition)
-> Lens Transition Transition (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transition' {Maybe Int
days :: Maybe Int
$sel:days:Transition' :: Transition -> Maybe Int
days} -> Maybe Int
days) (\s :: Transition
s@Transition' {} Maybe Int
a -> Transition
s {$sel:days:Transition' :: Maybe Int
days = Maybe Int
a} :: Transition)
transition_date :: Lens.Lens' Transition (Prelude.Maybe Prelude.UTCTime)
transition_date :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Transition -> f Transition
transition_date = (Transition -> Maybe ISO8601)
-> (Transition -> Maybe ISO8601 -> Transition)
-> Lens Transition Transition (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transition' {Maybe ISO8601
date :: Maybe ISO8601
$sel:date:Transition' :: Transition -> Maybe ISO8601
date} -> Maybe ISO8601
date) (\s :: Transition
s@Transition' {} Maybe ISO8601
a -> Transition
s {$sel:date:Transition' :: Maybe ISO8601
date = Maybe ISO8601
a} :: Transition) ((Maybe ISO8601 -> f (Maybe ISO8601))
-> Transition -> f Transition)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Transition
-> f Transition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
(Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
transition_storageClass :: Lens.Lens' Transition (Prelude.Maybe TransitionStorageClass)
transition_storageClass :: (Maybe TransitionStorageClass -> f (Maybe TransitionStorageClass))
-> Transition -> f Transition
transition_storageClass = (Transition -> Maybe TransitionStorageClass)
-> (Transition -> Maybe TransitionStorageClass -> Transition)
-> Lens
Transition
Transition
(Maybe TransitionStorageClass)
(Maybe TransitionStorageClass)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Transition' {Maybe TransitionStorageClass
storageClass :: Maybe TransitionStorageClass
$sel:storageClass:Transition' :: Transition -> Maybe TransitionStorageClass
storageClass} -> Maybe TransitionStorageClass
storageClass) (\s :: Transition
s@Transition' {} Maybe TransitionStorageClass
a -> Transition
s {$sel:storageClass:Transition' :: Maybe TransitionStorageClass
storageClass = Maybe TransitionStorageClass
a} :: Transition)
instance Core.FromXML Transition where
parseXML :: [Node] -> Either String Transition
parseXML [Node]
x =
Maybe Int
-> Maybe ISO8601 -> Maybe TransitionStorageClass -> Transition
Transition'
(Maybe Int
-> Maybe ISO8601 -> Maybe TransitionStorageClass -> Transition)
-> Either String (Maybe Int)
-> Either
String
(Maybe ISO8601 -> Maybe TransitionStorageClass -> Transition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Days")
Either
String
(Maybe ISO8601 -> Maybe TransitionStorageClass -> Transition)
-> Either String (Maybe ISO8601)
-> Either String (Maybe TransitionStorageClass -> Transition)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Date")
Either String (Maybe TransitionStorageClass -> Transition)
-> Either String (Maybe TransitionStorageClass)
-> Either String Transition
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe TransitionStorageClass)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StorageClass")
instance Prelude.Hashable Transition
instance Prelude.NFData Transition
instance Core.ToXML Transition where
toXML :: Transition -> XML
toXML Transition' {Maybe Int
Maybe ISO8601
Maybe TransitionStorageClass
storageClass :: Maybe TransitionStorageClass
date :: Maybe ISO8601
days :: Maybe Int
$sel:storageClass:Transition' :: Transition -> Maybe TransitionStorageClass
$sel:date:Transition' :: Transition -> Maybe ISO8601
$sel:days:Transition' :: Transition -> Maybe Int
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"Days" Name -> Maybe Int -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe Int
days,
Name
"Date" Name -> Maybe ISO8601 -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ISO8601
date,
Name
"StorageClass" Name -> Maybe TransitionStorageClass -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe TransitionStorageClass
storageClass
]