{-# 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.ResilienceHub.Types.PhysicalResourceId where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.ResilienceHub.Types.PhysicalIdentifierType
data PhysicalResourceId = PhysicalResourceId'
{
PhysicalResourceId -> Maybe Text
awsAccountId :: Prelude.Maybe Prelude.Text,
PhysicalResourceId -> Maybe Text
awsRegion :: Prelude.Maybe Prelude.Text,
PhysicalResourceId -> Text
identifier :: Prelude.Text,
PhysicalResourceId -> PhysicalIdentifierType
type' :: PhysicalIdentifierType
}
deriving (PhysicalResourceId -> PhysicalResourceId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PhysicalResourceId -> PhysicalResourceId -> Bool
$c/= :: PhysicalResourceId -> PhysicalResourceId -> Bool
== :: PhysicalResourceId -> PhysicalResourceId -> Bool
$c== :: PhysicalResourceId -> PhysicalResourceId -> Bool
Prelude.Eq, ReadPrec [PhysicalResourceId]
ReadPrec PhysicalResourceId
Int -> ReadS PhysicalResourceId
ReadS [PhysicalResourceId]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PhysicalResourceId]
$creadListPrec :: ReadPrec [PhysicalResourceId]
readPrec :: ReadPrec PhysicalResourceId
$creadPrec :: ReadPrec PhysicalResourceId
readList :: ReadS [PhysicalResourceId]
$creadList :: ReadS [PhysicalResourceId]
readsPrec :: Int -> ReadS PhysicalResourceId
$creadsPrec :: Int -> ReadS PhysicalResourceId
Prelude.Read, Int -> PhysicalResourceId -> ShowS
[PhysicalResourceId] -> ShowS
PhysicalResourceId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PhysicalResourceId] -> ShowS
$cshowList :: [PhysicalResourceId] -> ShowS
show :: PhysicalResourceId -> String
$cshow :: PhysicalResourceId -> String
showsPrec :: Int -> PhysicalResourceId -> ShowS
$cshowsPrec :: Int -> PhysicalResourceId -> ShowS
Prelude.Show, forall x. Rep PhysicalResourceId x -> PhysicalResourceId
forall x. PhysicalResourceId -> Rep PhysicalResourceId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PhysicalResourceId x -> PhysicalResourceId
$cfrom :: forall x. PhysicalResourceId -> Rep PhysicalResourceId x
Prelude.Generic)
newPhysicalResourceId ::
Prelude.Text ->
PhysicalIdentifierType ->
PhysicalResourceId
newPhysicalResourceId :: Text -> PhysicalIdentifierType -> PhysicalResourceId
newPhysicalResourceId Text
pIdentifier_ PhysicalIdentifierType
pType_ =
PhysicalResourceId'
{ $sel:awsAccountId:PhysicalResourceId' :: Maybe Text
awsAccountId = forall a. Maybe a
Prelude.Nothing,
$sel:awsRegion:PhysicalResourceId' :: Maybe Text
awsRegion = forall a. Maybe a
Prelude.Nothing,
$sel:identifier:PhysicalResourceId' :: Text
identifier = Text
pIdentifier_,
$sel:type':PhysicalResourceId' :: PhysicalIdentifierType
type' = PhysicalIdentifierType
pType_
}
physicalResourceId_awsAccountId :: Lens.Lens' PhysicalResourceId (Prelude.Maybe Prelude.Text)
physicalResourceId_awsAccountId :: Lens' PhysicalResourceId (Maybe Text)
physicalResourceId_awsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalResourceId' {Maybe Text
awsAccountId :: Maybe Text
$sel:awsAccountId:PhysicalResourceId' :: PhysicalResourceId -> Maybe Text
awsAccountId} -> Maybe Text
awsAccountId) (\s :: PhysicalResourceId
s@PhysicalResourceId' {} Maybe Text
a -> PhysicalResourceId
s {$sel:awsAccountId:PhysicalResourceId' :: Maybe Text
awsAccountId = Maybe Text
a} :: PhysicalResourceId)
physicalResourceId_awsRegion :: Lens.Lens' PhysicalResourceId (Prelude.Maybe Prelude.Text)
physicalResourceId_awsRegion :: Lens' PhysicalResourceId (Maybe Text)
physicalResourceId_awsRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalResourceId' {Maybe Text
awsRegion :: Maybe Text
$sel:awsRegion:PhysicalResourceId' :: PhysicalResourceId -> Maybe Text
awsRegion} -> Maybe Text
awsRegion) (\s :: PhysicalResourceId
s@PhysicalResourceId' {} Maybe Text
a -> PhysicalResourceId
s {$sel:awsRegion:PhysicalResourceId' :: Maybe Text
awsRegion = Maybe Text
a} :: PhysicalResourceId)
physicalResourceId_identifier :: Lens.Lens' PhysicalResourceId Prelude.Text
physicalResourceId_identifier :: Lens' PhysicalResourceId Text
physicalResourceId_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalResourceId' {Text
identifier :: Text
$sel:identifier:PhysicalResourceId' :: PhysicalResourceId -> Text
identifier} -> Text
identifier) (\s :: PhysicalResourceId
s@PhysicalResourceId' {} Text
a -> PhysicalResourceId
s {$sel:identifier:PhysicalResourceId' :: Text
identifier = Text
a} :: PhysicalResourceId)
physicalResourceId_type :: Lens.Lens' PhysicalResourceId PhysicalIdentifierType
physicalResourceId_type :: Lens' PhysicalResourceId PhysicalIdentifierType
physicalResourceId_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PhysicalResourceId' {PhysicalIdentifierType
type' :: PhysicalIdentifierType
$sel:type':PhysicalResourceId' :: PhysicalResourceId -> PhysicalIdentifierType
type'} -> PhysicalIdentifierType
type') (\s :: PhysicalResourceId
s@PhysicalResourceId' {} PhysicalIdentifierType
a -> PhysicalResourceId
s {$sel:type':PhysicalResourceId' :: PhysicalIdentifierType
type' = PhysicalIdentifierType
a} :: PhysicalResourceId)
instance Data.FromJSON PhysicalResourceId where
parseJSON :: Value -> Parser PhysicalResourceId
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PhysicalResourceId"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Text
-> PhysicalIdentifierType
-> PhysicalResourceId
PhysicalResourceId'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"awsAccountId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"awsRegion")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"identifier")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"type")
)
instance Prelude.Hashable PhysicalResourceId where
hashWithSalt :: Int -> PhysicalResourceId -> Int
hashWithSalt Int
_salt PhysicalResourceId' {Maybe Text
Text
PhysicalIdentifierType
type' :: PhysicalIdentifierType
identifier :: Text
awsRegion :: Maybe Text
awsAccountId :: Maybe Text
$sel:type':PhysicalResourceId' :: PhysicalResourceId -> PhysicalIdentifierType
$sel:identifier:PhysicalResourceId' :: PhysicalResourceId -> Text
$sel:awsRegion:PhysicalResourceId' :: PhysicalResourceId -> Maybe Text
$sel:awsAccountId:PhysicalResourceId' :: PhysicalResourceId -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsAccountId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsRegion
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
identifier
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PhysicalIdentifierType
type'
instance Prelude.NFData PhysicalResourceId where
rnf :: PhysicalResourceId -> ()
rnf PhysicalResourceId' {Maybe Text
Text
PhysicalIdentifierType
type' :: PhysicalIdentifierType
identifier :: Text
awsRegion :: Maybe Text
awsAccountId :: Maybe Text
$sel:type':PhysicalResourceId' :: PhysicalResourceId -> PhysicalIdentifierType
$sel:identifier:PhysicalResourceId' :: PhysicalResourceId -> Text
$sel:awsRegion:PhysicalResourceId' :: PhysicalResourceId -> Maybe Text
$sel:awsAccountId:PhysicalResourceId' :: PhysicalResourceId -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsAccountId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsRegion
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
identifier
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PhysicalIdentifierType
type'
instance Data.ToJSON PhysicalResourceId where
toJSON :: PhysicalResourceId -> Value
toJSON PhysicalResourceId' {Maybe Text
Text
PhysicalIdentifierType
type' :: PhysicalIdentifierType
identifier :: Text
awsRegion :: Maybe Text
awsAccountId :: Maybe Text
$sel:type':PhysicalResourceId' :: PhysicalResourceId -> PhysicalIdentifierType
$sel:identifier:PhysicalResourceId' :: PhysicalResourceId -> Text
$sel:awsRegion:PhysicalResourceId' :: PhysicalResourceId -> Maybe Text
$sel:awsAccountId:PhysicalResourceId' :: PhysicalResourceId -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"awsAccountId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
awsAccountId,
(Key
"awsRegion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
awsRegion,
forall a. a -> Maybe a
Prelude.Just (Key
"identifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
identifier),
forall a. a -> Maybe a
Prelude.Just (Key
"type" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PhysicalIdentifierType
type')
]
)