{-# 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.IdentityStore.Types.ExternalId 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
data ExternalId = ExternalId'
{
ExternalId -> Sensitive Text
issuer :: Data.Sensitive Prelude.Text,
ExternalId -> Sensitive Text
id :: Data.Sensitive Prelude.Text
}
deriving (ExternalId -> ExternalId -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalId -> ExternalId -> Bool
$c/= :: ExternalId -> ExternalId -> Bool
== :: ExternalId -> ExternalId -> Bool
$c== :: ExternalId -> ExternalId -> Bool
Prelude.Eq, Int -> ExternalId -> ShowS
[ExternalId] -> ShowS
ExternalId -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExternalId] -> ShowS
$cshowList :: [ExternalId] -> ShowS
show :: ExternalId -> String
$cshow :: ExternalId -> String
showsPrec :: Int -> ExternalId -> ShowS
$cshowsPrec :: Int -> ExternalId -> ShowS
Prelude.Show, forall x. Rep ExternalId x -> ExternalId
forall x. ExternalId -> Rep ExternalId x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExternalId x -> ExternalId
$cfrom :: forall x. ExternalId -> Rep ExternalId x
Prelude.Generic)
newExternalId ::
Prelude.Text ->
Prelude.Text ->
ExternalId
newExternalId :: Text -> Text -> ExternalId
newExternalId Text
pIssuer_ Text
pId_ =
ExternalId'
{ $sel:issuer:ExternalId' :: Sensitive Text
issuer =
forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pIssuer_,
$sel:id:ExternalId' :: Sensitive Text
id = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pId_
}
externalId_issuer :: Lens.Lens' ExternalId Prelude.Text
externalId_issuer :: Lens' ExternalId Text
externalId_issuer = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalId' {Sensitive Text
issuer :: Sensitive Text
$sel:issuer:ExternalId' :: ExternalId -> Sensitive Text
issuer} -> Sensitive Text
issuer) (\s :: ExternalId
s@ExternalId' {} Sensitive Text
a -> ExternalId
s {$sel:issuer:ExternalId' :: Sensitive Text
issuer = Sensitive Text
a} :: ExternalId) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
externalId_id :: Lens.Lens' ExternalId Prelude.Text
externalId_id :: Lens' ExternalId Text
externalId_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalId' {Sensitive Text
id :: Sensitive Text
$sel:id:ExternalId' :: ExternalId -> Sensitive Text
id} -> Sensitive Text
id) (\s :: ExternalId
s@ExternalId' {} Sensitive Text
a -> ExternalId
s {$sel:id:ExternalId' :: Sensitive Text
id = Sensitive Text
a} :: ExternalId) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Data.FromJSON ExternalId where
parseJSON :: Value -> Parser ExternalId
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ExternalId"
( \Object
x ->
Sensitive Text -> Sensitive Text -> ExternalId
ExternalId'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Issuer")
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
"Id")
)
instance Prelude.Hashable ExternalId where
hashWithSalt :: Int -> ExternalId -> Int
hashWithSalt Int
_salt ExternalId' {Sensitive Text
id :: Sensitive Text
issuer :: Sensitive Text
$sel:id:ExternalId' :: ExternalId -> Sensitive Text
$sel:issuer:ExternalId' :: ExternalId -> Sensitive Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
issuer
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
id
instance Prelude.NFData ExternalId where
rnf :: ExternalId -> ()
rnf ExternalId' {Sensitive Text
id :: Sensitive Text
issuer :: Sensitive Text
$sel:id:ExternalId' :: ExternalId -> Sensitive Text
$sel:issuer:ExternalId' :: ExternalId -> Sensitive Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
issuer seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive Text
id
instance Data.ToJSON ExternalId where
toJSON :: ExternalId -> Value
toJSON ExternalId' {Sensitive Text
id :: Sensitive Text
issuer :: Sensitive Text
$sel:id:ExternalId' :: ExternalId -> Sensitive Text
$sel:issuer:ExternalId' :: ExternalId -> Sensitive Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"Issuer" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
issuer),
forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
id)
]
)