{-# 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.Config.Types.ResourceIdentifier where
import Amazonka.Config.Types.ResourceType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ResourceIdentifier = ResourceIdentifier'
{
ResourceIdentifier -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
ResourceIdentifier -> Maybe ResourceType
resourceType :: Prelude.Maybe ResourceType,
ResourceIdentifier -> Maybe Text
resourceName :: Prelude.Maybe Prelude.Text,
ResourceIdentifier -> Maybe POSIX
resourceDeletionTime :: Prelude.Maybe Core.POSIX
}
deriving (ResourceIdentifier -> ResourceIdentifier -> Bool
(ResourceIdentifier -> ResourceIdentifier -> Bool)
-> (ResourceIdentifier -> ResourceIdentifier -> Bool)
-> Eq ResourceIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceIdentifier -> ResourceIdentifier -> Bool
$c/= :: ResourceIdentifier -> ResourceIdentifier -> Bool
== :: ResourceIdentifier -> ResourceIdentifier -> Bool
$c== :: ResourceIdentifier -> ResourceIdentifier -> Bool
Prelude.Eq, ReadPrec [ResourceIdentifier]
ReadPrec ResourceIdentifier
Int -> ReadS ResourceIdentifier
ReadS [ResourceIdentifier]
(Int -> ReadS ResourceIdentifier)
-> ReadS [ResourceIdentifier]
-> ReadPrec ResourceIdentifier
-> ReadPrec [ResourceIdentifier]
-> Read ResourceIdentifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceIdentifier]
$creadListPrec :: ReadPrec [ResourceIdentifier]
readPrec :: ReadPrec ResourceIdentifier
$creadPrec :: ReadPrec ResourceIdentifier
readList :: ReadS [ResourceIdentifier]
$creadList :: ReadS [ResourceIdentifier]
readsPrec :: Int -> ReadS ResourceIdentifier
$creadsPrec :: Int -> ReadS ResourceIdentifier
Prelude.Read, Int -> ResourceIdentifier -> ShowS
[ResourceIdentifier] -> ShowS
ResourceIdentifier -> String
(Int -> ResourceIdentifier -> ShowS)
-> (ResourceIdentifier -> String)
-> ([ResourceIdentifier] -> ShowS)
-> Show ResourceIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceIdentifier] -> ShowS
$cshowList :: [ResourceIdentifier] -> ShowS
show :: ResourceIdentifier -> String
$cshow :: ResourceIdentifier -> String
showsPrec :: Int -> ResourceIdentifier -> ShowS
$cshowsPrec :: Int -> ResourceIdentifier -> ShowS
Prelude.Show, (forall x. ResourceIdentifier -> Rep ResourceIdentifier x)
-> (forall x. Rep ResourceIdentifier x -> ResourceIdentifier)
-> Generic ResourceIdentifier
forall x. Rep ResourceIdentifier x -> ResourceIdentifier
forall x. ResourceIdentifier -> Rep ResourceIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceIdentifier x -> ResourceIdentifier
$cfrom :: forall x. ResourceIdentifier -> Rep ResourceIdentifier x
Prelude.Generic)
newResourceIdentifier ::
ResourceIdentifier
newResourceIdentifier :: ResourceIdentifier
newResourceIdentifier =
ResourceIdentifier' :: Maybe Text
-> Maybe ResourceType
-> Maybe Text
-> Maybe POSIX
-> ResourceIdentifier
ResourceIdentifier'
{ $sel:resourceId:ResourceIdentifier' :: Maybe Text
resourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceType:ResourceIdentifier' :: Maybe ResourceType
resourceType = Maybe ResourceType
forall a. Maybe a
Prelude.Nothing,
$sel:resourceName:ResourceIdentifier' :: Maybe Text
resourceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceDeletionTime:ResourceIdentifier' :: Maybe POSIX
resourceDeletionTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
resourceIdentifier_resourceId :: Lens.Lens' ResourceIdentifier (Prelude.Maybe Prelude.Text)
resourceIdentifier_resourceId :: (Maybe Text -> f (Maybe Text))
-> ResourceIdentifier -> f ResourceIdentifier
resourceIdentifier_resourceId = (ResourceIdentifier -> Maybe Text)
-> (ResourceIdentifier -> Maybe Text -> ResourceIdentifier)
-> Lens
ResourceIdentifier ResourceIdentifier (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceIdentifier' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:ResourceIdentifier' :: ResourceIdentifier -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: ResourceIdentifier
s@ResourceIdentifier' {} Maybe Text
a -> ResourceIdentifier
s {$sel:resourceId:ResourceIdentifier' :: Maybe Text
resourceId = Maybe Text
a} :: ResourceIdentifier)
resourceIdentifier_resourceType :: Lens.Lens' ResourceIdentifier (Prelude.Maybe ResourceType)
resourceIdentifier_resourceType :: (Maybe ResourceType -> f (Maybe ResourceType))
-> ResourceIdentifier -> f ResourceIdentifier
resourceIdentifier_resourceType = (ResourceIdentifier -> Maybe ResourceType)
-> (ResourceIdentifier -> Maybe ResourceType -> ResourceIdentifier)
-> Lens
ResourceIdentifier
ResourceIdentifier
(Maybe ResourceType)
(Maybe ResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceIdentifier' {Maybe ResourceType
resourceType :: Maybe ResourceType
$sel:resourceType:ResourceIdentifier' :: ResourceIdentifier -> Maybe ResourceType
resourceType} -> Maybe ResourceType
resourceType) (\s :: ResourceIdentifier
s@ResourceIdentifier' {} Maybe ResourceType
a -> ResourceIdentifier
s {$sel:resourceType:ResourceIdentifier' :: Maybe ResourceType
resourceType = Maybe ResourceType
a} :: ResourceIdentifier)
resourceIdentifier_resourceName :: Lens.Lens' ResourceIdentifier (Prelude.Maybe Prelude.Text)
resourceIdentifier_resourceName :: (Maybe Text -> f (Maybe Text))
-> ResourceIdentifier -> f ResourceIdentifier
resourceIdentifier_resourceName = (ResourceIdentifier -> Maybe Text)
-> (ResourceIdentifier -> Maybe Text -> ResourceIdentifier)
-> Lens
ResourceIdentifier ResourceIdentifier (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceIdentifier' {Maybe Text
resourceName :: Maybe Text
$sel:resourceName:ResourceIdentifier' :: ResourceIdentifier -> Maybe Text
resourceName} -> Maybe Text
resourceName) (\s :: ResourceIdentifier
s@ResourceIdentifier' {} Maybe Text
a -> ResourceIdentifier
s {$sel:resourceName:ResourceIdentifier' :: Maybe Text
resourceName = Maybe Text
a} :: ResourceIdentifier)
resourceIdentifier_resourceDeletionTime :: Lens.Lens' ResourceIdentifier (Prelude.Maybe Prelude.UTCTime)
resourceIdentifier_resourceDeletionTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ResourceIdentifier -> f ResourceIdentifier
resourceIdentifier_resourceDeletionTime = (ResourceIdentifier -> Maybe POSIX)
-> (ResourceIdentifier -> Maybe POSIX -> ResourceIdentifier)
-> Lens
ResourceIdentifier ResourceIdentifier (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceIdentifier' {Maybe POSIX
resourceDeletionTime :: Maybe POSIX
$sel:resourceDeletionTime:ResourceIdentifier' :: ResourceIdentifier -> Maybe POSIX
resourceDeletionTime} -> Maybe POSIX
resourceDeletionTime) (\s :: ResourceIdentifier
s@ResourceIdentifier' {} Maybe POSIX
a -> ResourceIdentifier
s {$sel:resourceDeletionTime:ResourceIdentifier' :: Maybe POSIX
resourceDeletionTime = Maybe POSIX
a} :: ResourceIdentifier) ((Maybe POSIX -> f (Maybe POSIX))
-> ResourceIdentifier -> f ResourceIdentifier)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ResourceIdentifier
-> f ResourceIdentifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromJSON ResourceIdentifier where
parseJSON :: Value -> Parser ResourceIdentifier
parseJSON =
String
-> (Object -> Parser ResourceIdentifier)
-> Value
-> Parser ResourceIdentifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ResourceIdentifier"
( \Object
x ->
Maybe Text
-> Maybe ResourceType
-> Maybe Text
-> Maybe POSIX
-> ResourceIdentifier
ResourceIdentifier'
(Maybe Text
-> Maybe ResourceType
-> Maybe Text
-> Maybe POSIX
-> ResourceIdentifier)
-> Parser (Maybe Text)
-> Parser
(Maybe ResourceType
-> Maybe Text -> Maybe POSIX -> ResourceIdentifier)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceId")
Parser
(Maybe ResourceType
-> Maybe Text -> Maybe POSIX -> ResourceIdentifier)
-> Parser (Maybe ResourceType)
-> Parser (Maybe Text -> Maybe POSIX -> ResourceIdentifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceType")
Parser (Maybe Text -> Maybe POSIX -> ResourceIdentifier)
-> Parser (Maybe Text)
-> Parser (Maybe POSIX -> ResourceIdentifier)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceName")
Parser (Maybe POSIX -> ResourceIdentifier)
-> Parser (Maybe POSIX) -> Parser ResourceIdentifier
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resourceDeletionTime")
)
instance Prelude.Hashable ResourceIdentifier
instance Prelude.NFData ResourceIdentifier