{-# 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.Organizations.Types.HandshakeParty where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Organizations.Types.HandshakePartyType
import qualified Amazonka.Prelude as Prelude
data HandshakeParty = HandshakeParty'
{
HandshakeParty -> Sensitive Text
id :: Core.Sensitive Prelude.Text,
HandshakeParty -> HandshakePartyType
type' :: HandshakePartyType
}
deriving (HandshakeParty -> HandshakeParty -> Bool
(HandshakeParty -> HandshakeParty -> Bool)
-> (HandshakeParty -> HandshakeParty -> Bool) -> Eq HandshakeParty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HandshakeParty -> HandshakeParty -> Bool
$c/= :: HandshakeParty -> HandshakeParty -> Bool
== :: HandshakeParty -> HandshakeParty -> Bool
$c== :: HandshakeParty -> HandshakeParty -> Bool
Prelude.Eq, Int -> HandshakeParty -> ShowS
[HandshakeParty] -> ShowS
HandshakeParty -> String
(Int -> HandshakeParty -> ShowS)
-> (HandshakeParty -> String)
-> ([HandshakeParty] -> ShowS)
-> Show HandshakeParty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HandshakeParty] -> ShowS
$cshowList :: [HandshakeParty] -> ShowS
show :: HandshakeParty -> String
$cshow :: HandshakeParty -> String
showsPrec :: Int -> HandshakeParty -> ShowS
$cshowsPrec :: Int -> HandshakeParty -> ShowS
Prelude.Show, (forall x. HandshakeParty -> Rep HandshakeParty x)
-> (forall x. Rep HandshakeParty x -> HandshakeParty)
-> Generic HandshakeParty
forall x. Rep HandshakeParty x -> HandshakeParty
forall x. HandshakeParty -> Rep HandshakeParty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HandshakeParty x -> HandshakeParty
$cfrom :: forall x. HandshakeParty -> Rep HandshakeParty x
Prelude.Generic)
newHandshakeParty ::
Prelude.Text ->
HandshakePartyType ->
HandshakeParty
newHandshakeParty :: Text -> HandshakePartyType -> HandshakeParty
newHandshakeParty Text
pId_ HandshakePartyType
pType_ =
HandshakeParty' :: Sensitive Text -> HandshakePartyType -> HandshakeParty
HandshakeParty'
{ $sel:id:HandshakeParty' :: Sensitive Text
id = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pId_,
$sel:type':HandshakeParty' :: HandshakePartyType
type' = HandshakePartyType
pType_
}
handshakeParty_id :: Lens.Lens' HandshakeParty Prelude.Text
handshakeParty_id :: (Text -> f Text) -> HandshakeParty -> f HandshakeParty
handshakeParty_id = (HandshakeParty -> Sensitive Text)
-> (HandshakeParty -> Sensitive Text -> HandshakeParty)
-> Lens
HandshakeParty HandshakeParty (Sensitive Text) (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HandshakeParty' {Sensitive Text
id :: Sensitive Text
$sel:id:HandshakeParty' :: HandshakeParty -> Sensitive Text
id} -> Sensitive Text
id) (\s :: HandshakeParty
s@HandshakeParty' {} Sensitive Text
a -> HandshakeParty
s {$sel:id:HandshakeParty' :: Sensitive Text
id = Sensitive Text
a} :: HandshakeParty) ((Sensitive Text -> f (Sensitive Text))
-> HandshakeParty -> f HandshakeParty)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> HandshakeParty
-> f HandshakeParty
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive
handshakeParty_type :: Lens.Lens' HandshakeParty HandshakePartyType
handshakeParty_type :: (HandshakePartyType -> f HandshakePartyType)
-> HandshakeParty -> f HandshakeParty
handshakeParty_type = (HandshakeParty -> HandshakePartyType)
-> (HandshakeParty -> HandshakePartyType -> HandshakeParty)
-> Lens
HandshakeParty HandshakeParty HandshakePartyType HandshakePartyType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HandshakeParty' {HandshakePartyType
type' :: HandshakePartyType
$sel:type':HandshakeParty' :: HandshakeParty -> HandshakePartyType
type'} -> HandshakePartyType
type') (\s :: HandshakeParty
s@HandshakeParty' {} HandshakePartyType
a -> HandshakeParty
s {$sel:type':HandshakeParty' :: HandshakePartyType
type' = HandshakePartyType
a} :: HandshakeParty)
instance Core.FromJSON HandshakeParty where
parseJSON :: Value -> Parser HandshakeParty
parseJSON =
String
-> (Object -> Parser HandshakeParty)
-> Value
-> Parser HandshakeParty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HandshakeParty"
( \Object
x ->
Sensitive Text -> HandshakePartyType -> HandshakeParty
HandshakeParty'
(Sensitive Text -> HandshakePartyType -> HandshakeParty)
-> Parser (Sensitive Text)
-> Parser (HandshakePartyType -> HandshakeParty)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Sensitive Text)
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Id") Parser (HandshakePartyType -> HandshakeParty)
-> Parser HandshakePartyType -> Parser HandshakeParty
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser HandshakePartyType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Type")
)
instance Prelude.Hashable HandshakeParty
instance Prelude.NFData HandshakeParty
instance Core.ToJSON HandshakeParty where
toJSON :: HandshakeParty -> Value
toJSON HandshakeParty' {Sensitive Text
HandshakePartyType
type' :: HandshakePartyType
id :: Sensitive Text
$sel:type':HandshakeParty' :: HandshakeParty -> HandshakePartyType
$sel:id:HandshakeParty' :: HandshakeParty -> Sensitive Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
id),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> HandshakePartyType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HandshakePartyType
type')
]
)