{-# 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.Handshake where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Organizations.Types.ActionType
import Amazonka.Organizations.Types.HandshakeParty
import Amazonka.Organizations.Types.HandshakeResource
import Amazonka.Organizations.Types.HandshakeState
import qualified Amazonka.Prelude as Prelude
data Handshake = Handshake'
{
Handshake -> Maybe HandshakeState
state :: Prelude.Maybe HandshakeState,
Handshake -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
Handshake -> Maybe ActionType
action :: Prelude.Maybe ActionType,
Handshake -> Maybe [HandshakeResource]
resources :: Prelude.Maybe [HandshakeResource],
Handshake -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
Handshake -> Maybe POSIX
expirationTimestamp :: Prelude.Maybe Core.POSIX,
Handshake -> Maybe [HandshakeParty]
parties :: Prelude.Maybe [HandshakeParty],
Handshake -> Maybe POSIX
requestedTimestamp :: Prelude.Maybe Core.POSIX
}
deriving (Handshake -> Handshake -> Bool
(Handshake -> Handshake -> Bool)
-> (Handshake -> Handshake -> Bool) -> Eq Handshake
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Handshake -> Handshake -> Bool
$c/= :: Handshake -> Handshake -> Bool
== :: Handshake -> Handshake -> Bool
$c== :: Handshake -> Handshake -> Bool
Prelude.Eq, Int -> Handshake -> ShowS
[Handshake] -> ShowS
Handshake -> String
(Int -> Handshake -> ShowS)
-> (Handshake -> String)
-> ([Handshake] -> ShowS)
-> Show Handshake
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Handshake] -> ShowS
$cshowList :: [Handshake] -> ShowS
show :: Handshake -> String
$cshow :: Handshake -> String
showsPrec :: Int -> Handshake -> ShowS
$cshowsPrec :: Int -> Handshake -> ShowS
Prelude.Show, (forall x. Handshake -> Rep Handshake x)
-> (forall x. Rep Handshake x -> Handshake) -> Generic Handshake
forall x. Rep Handshake x -> Handshake
forall x. Handshake -> Rep Handshake x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Handshake x -> Handshake
$cfrom :: forall x. Handshake -> Rep Handshake x
Prelude.Generic)
newHandshake ::
Handshake
newHandshake :: Handshake
newHandshake =
Handshake' :: Maybe HandshakeState
-> Maybe Text
-> Maybe ActionType
-> Maybe [HandshakeResource]
-> Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake
Handshake'
{ $sel:state:Handshake' :: Maybe HandshakeState
state = Maybe HandshakeState
forall a. Maybe a
Prelude.Nothing,
$sel:arn:Handshake' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:action:Handshake' :: Maybe ActionType
action = Maybe ActionType
forall a. Maybe a
Prelude.Nothing,
$sel:resources:Handshake' :: Maybe [HandshakeResource]
resources = Maybe [HandshakeResource]
forall a. Maybe a
Prelude.Nothing,
$sel:id:Handshake' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:expirationTimestamp:Handshake' :: Maybe POSIX
expirationTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:parties:Handshake' :: Maybe [HandshakeParty]
parties = Maybe [HandshakeParty]
forall a. Maybe a
Prelude.Nothing,
$sel:requestedTimestamp:Handshake' :: Maybe POSIX
requestedTimestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
handshake_state :: Lens.Lens' Handshake (Prelude.Maybe HandshakeState)
handshake_state :: (Maybe HandshakeState -> f (Maybe HandshakeState))
-> Handshake -> f Handshake
handshake_state = (Handshake -> Maybe HandshakeState)
-> (Handshake -> Maybe HandshakeState -> Handshake)
-> Lens
Handshake Handshake (Maybe HandshakeState) (Maybe HandshakeState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Handshake' {Maybe HandshakeState
state :: Maybe HandshakeState
$sel:state:Handshake' :: Handshake -> Maybe HandshakeState
state} -> Maybe HandshakeState
state) (\s :: Handshake
s@Handshake' {} Maybe HandshakeState
a -> Handshake
s {$sel:state:Handshake' :: Maybe HandshakeState
state = Maybe HandshakeState
a} :: Handshake)
handshake_arn :: Lens.Lens' Handshake (Prelude.Maybe Prelude.Text)
handshake_arn :: (Maybe Text -> f (Maybe Text)) -> Handshake -> f Handshake
handshake_arn = (Handshake -> Maybe Text)
-> (Handshake -> Maybe Text -> Handshake)
-> Lens Handshake Handshake (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Handshake' {Maybe Text
arn :: Maybe Text
$sel:arn:Handshake' :: Handshake -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Handshake
s@Handshake' {} Maybe Text
a -> Handshake
s {$sel:arn:Handshake' :: Maybe Text
arn = Maybe Text
a} :: Handshake)
handshake_action :: Lens.Lens' Handshake (Prelude.Maybe ActionType)
handshake_action :: (Maybe ActionType -> f (Maybe ActionType))
-> Handshake -> f Handshake
handshake_action = (Handshake -> Maybe ActionType)
-> (Handshake -> Maybe ActionType -> Handshake)
-> Lens Handshake Handshake (Maybe ActionType) (Maybe ActionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Handshake' {Maybe ActionType
action :: Maybe ActionType
$sel:action:Handshake' :: Handshake -> Maybe ActionType
action} -> Maybe ActionType
action) (\s :: Handshake
s@Handshake' {} Maybe ActionType
a -> Handshake
s {$sel:action:Handshake' :: Maybe ActionType
action = Maybe ActionType
a} :: Handshake)
handshake_resources :: Lens.Lens' Handshake (Prelude.Maybe [HandshakeResource])
handshake_resources :: (Maybe [HandshakeResource] -> f (Maybe [HandshakeResource]))
-> Handshake -> f Handshake
handshake_resources = (Handshake -> Maybe [HandshakeResource])
-> (Handshake -> Maybe [HandshakeResource] -> Handshake)
-> Lens
Handshake
Handshake
(Maybe [HandshakeResource])
(Maybe [HandshakeResource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Handshake' {Maybe [HandshakeResource]
resources :: Maybe [HandshakeResource]
$sel:resources:Handshake' :: Handshake -> Maybe [HandshakeResource]
resources} -> Maybe [HandshakeResource]
resources) (\s :: Handshake
s@Handshake' {} Maybe [HandshakeResource]
a -> Handshake
s {$sel:resources:Handshake' :: Maybe [HandshakeResource]
resources = Maybe [HandshakeResource]
a} :: Handshake) ((Maybe [HandshakeResource] -> f (Maybe [HandshakeResource]))
-> Handshake -> f Handshake)
-> ((Maybe [HandshakeResource] -> f (Maybe [HandshakeResource]))
-> Maybe [HandshakeResource] -> f (Maybe [HandshakeResource]))
-> (Maybe [HandshakeResource] -> f (Maybe [HandshakeResource]))
-> Handshake
-> f Handshake
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[HandshakeResource]
[HandshakeResource]
[HandshakeResource]
[HandshakeResource]
-> Iso
(Maybe [HandshakeResource])
(Maybe [HandshakeResource])
(Maybe [HandshakeResource])
(Maybe [HandshakeResource])
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
[HandshakeResource]
[HandshakeResource]
[HandshakeResource]
[HandshakeResource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
handshake_id :: Lens.Lens' Handshake (Prelude.Maybe Prelude.Text)
handshake_id :: (Maybe Text -> f (Maybe Text)) -> Handshake -> f Handshake
handshake_id = (Handshake -> Maybe Text)
-> (Handshake -> Maybe Text -> Handshake)
-> Lens Handshake Handshake (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Handshake' {Maybe Text
id :: Maybe Text
$sel:id:Handshake' :: Handshake -> Maybe Text
id} -> Maybe Text
id) (\s :: Handshake
s@Handshake' {} Maybe Text
a -> Handshake
s {$sel:id:Handshake' :: Maybe Text
id = Maybe Text
a} :: Handshake)
handshake_expirationTimestamp :: Lens.Lens' Handshake (Prelude.Maybe Prelude.UTCTime)
handshake_expirationTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Handshake -> f Handshake
handshake_expirationTimestamp = (Handshake -> Maybe POSIX)
-> (Handshake -> Maybe POSIX -> Handshake)
-> Lens Handshake Handshake (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Handshake' {Maybe POSIX
expirationTimestamp :: Maybe POSIX
$sel:expirationTimestamp:Handshake' :: Handshake -> Maybe POSIX
expirationTimestamp} -> Maybe POSIX
expirationTimestamp) (\s :: Handshake
s@Handshake' {} Maybe POSIX
a -> Handshake
s {$sel:expirationTimestamp:Handshake' :: Maybe POSIX
expirationTimestamp = Maybe POSIX
a} :: Handshake) ((Maybe POSIX -> f (Maybe POSIX)) -> Handshake -> f Handshake)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Handshake
-> f Handshake
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
handshake_parties :: Lens.Lens' Handshake (Prelude.Maybe [HandshakeParty])
handshake_parties :: (Maybe [HandshakeParty] -> f (Maybe [HandshakeParty]))
-> Handshake -> f Handshake
handshake_parties = (Handshake -> Maybe [HandshakeParty])
-> (Handshake -> Maybe [HandshakeParty] -> Handshake)
-> Lens
Handshake
Handshake
(Maybe [HandshakeParty])
(Maybe [HandshakeParty])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Handshake' {Maybe [HandshakeParty]
parties :: Maybe [HandshakeParty]
$sel:parties:Handshake' :: Handshake -> Maybe [HandshakeParty]
parties} -> Maybe [HandshakeParty]
parties) (\s :: Handshake
s@Handshake' {} Maybe [HandshakeParty]
a -> Handshake
s {$sel:parties:Handshake' :: Maybe [HandshakeParty]
parties = Maybe [HandshakeParty]
a} :: Handshake) ((Maybe [HandshakeParty] -> f (Maybe [HandshakeParty]))
-> Handshake -> f Handshake)
-> ((Maybe [HandshakeParty] -> f (Maybe [HandshakeParty]))
-> Maybe [HandshakeParty] -> f (Maybe [HandshakeParty]))
-> (Maybe [HandshakeParty] -> f (Maybe [HandshakeParty]))
-> Handshake
-> f Handshake
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[HandshakeParty] [HandshakeParty] [HandshakeParty] [HandshakeParty]
-> Iso
(Maybe [HandshakeParty])
(Maybe [HandshakeParty])
(Maybe [HandshakeParty])
(Maybe [HandshakeParty])
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
[HandshakeParty] [HandshakeParty] [HandshakeParty] [HandshakeParty]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
handshake_requestedTimestamp :: Lens.Lens' Handshake (Prelude.Maybe Prelude.UTCTime)
handshake_requestedTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Handshake -> f Handshake
handshake_requestedTimestamp = (Handshake -> Maybe POSIX)
-> (Handshake -> Maybe POSIX -> Handshake)
-> Lens Handshake Handshake (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Handshake' {Maybe POSIX
requestedTimestamp :: Maybe POSIX
$sel:requestedTimestamp:Handshake' :: Handshake -> Maybe POSIX
requestedTimestamp} -> Maybe POSIX
requestedTimestamp) (\s :: Handshake
s@Handshake' {} Maybe POSIX
a -> Handshake
s {$sel:requestedTimestamp:Handshake' :: Maybe POSIX
requestedTimestamp = Maybe POSIX
a} :: Handshake) ((Maybe POSIX -> f (Maybe POSIX)) -> Handshake -> f Handshake)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Handshake
-> f Handshake
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 Handshake where
parseJSON :: Value -> Parser Handshake
parseJSON =
String -> (Object -> Parser Handshake) -> Value -> Parser Handshake
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Handshake"
( \Object
x ->
Maybe HandshakeState
-> Maybe Text
-> Maybe ActionType
-> Maybe [HandshakeResource]
-> Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake
Handshake'
(Maybe HandshakeState
-> Maybe Text
-> Maybe ActionType
-> Maybe [HandshakeResource]
-> Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake)
-> Parser (Maybe HandshakeState)
-> Parser
(Maybe Text
-> Maybe ActionType
-> Maybe [HandshakeResource]
-> Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe HandshakeState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"State")
Parser
(Maybe Text
-> Maybe ActionType
-> Maybe [HandshakeResource]
-> Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake)
-> Parser (Maybe Text)
-> Parser
(Maybe ActionType
-> Maybe [HandshakeResource]
-> Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake)
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
"Arn")
Parser
(Maybe ActionType
-> Maybe [HandshakeResource]
-> Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake)
-> Parser (Maybe ActionType)
-> Parser
(Maybe [HandshakeResource]
-> Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ActionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Action")
Parser
(Maybe [HandshakeResource]
-> Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake)
-> Parser (Maybe [HandshakeResource])
-> Parser
(Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [HandshakeResource]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Resources" Parser (Maybe (Maybe [HandshakeResource]))
-> Maybe [HandshakeResource] -> Parser (Maybe [HandshakeResource])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [HandshakeResource]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Maybe POSIX
-> Maybe [HandshakeParty]
-> Maybe POSIX
-> Handshake)
-> Parser (Maybe Text)
-> Parser
(Maybe POSIX -> Maybe [HandshakeParty] -> Maybe POSIX -> Handshake)
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
"Id")
Parser
(Maybe POSIX -> Maybe [HandshakeParty] -> Maybe POSIX -> Handshake)
-> Parser (Maybe POSIX)
-> Parser (Maybe [HandshakeParty] -> Maybe POSIX -> Handshake)
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
"ExpirationTimestamp")
Parser (Maybe [HandshakeParty] -> Maybe POSIX -> Handshake)
-> Parser (Maybe [HandshakeParty])
-> Parser (Maybe POSIX -> Handshake)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [HandshakeParty]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Parties" Parser (Maybe (Maybe [HandshakeParty]))
-> Maybe [HandshakeParty] -> Parser (Maybe [HandshakeParty])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [HandshakeParty]
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe POSIX -> Handshake)
-> Parser (Maybe POSIX) -> Parser Handshake
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
"RequestedTimestamp")
)
instance Prelude.Hashable Handshake
instance Prelude.NFData Handshake