{-# 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.HandshakeResource where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Organizations.Types.HandshakeResourceType
import qualified Amazonka.Prelude as Prelude
data HandshakeResource = HandshakeResource'
{
HandshakeResource -> Maybe (Sensitive Text)
value :: Prelude.Maybe (Core.Sensitive Prelude.Text),
HandshakeResource -> Maybe [HandshakeResource]
resources :: Prelude.Maybe [HandshakeResource],
HandshakeResource -> Maybe HandshakeResourceType
type' :: Prelude.Maybe HandshakeResourceType
}
deriving (HandshakeResource -> HandshakeResource -> Bool
(HandshakeResource -> HandshakeResource -> Bool)
-> (HandshakeResource -> HandshakeResource -> Bool)
-> Eq HandshakeResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HandshakeResource -> HandshakeResource -> Bool
$c/= :: HandshakeResource -> HandshakeResource -> Bool
== :: HandshakeResource -> HandshakeResource -> Bool
$c== :: HandshakeResource -> HandshakeResource -> Bool
Prelude.Eq, Int -> HandshakeResource -> ShowS
[HandshakeResource] -> ShowS
HandshakeResource -> String
(Int -> HandshakeResource -> ShowS)
-> (HandshakeResource -> String)
-> ([HandshakeResource] -> ShowS)
-> Show HandshakeResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HandshakeResource] -> ShowS
$cshowList :: [HandshakeResource] -> ShowS
show :: HandshakeResource -> String
$cshow :: HandshakeResource -> String
showsPrec :: Int -> HandshakeResource -> ShowS
$cshowsPrec :: Int -> HandshakeResource -> ShowS
Prelude.Show, (forall x. HandshakeResource -> Rep HandshakeResource x)
-> (forall x. Rep HandshakeResource x -> HandshakeResource)
-> Generic HandshakeResource
forall x. Rep HandshakeResource x -> HandshakeResource
forall x. HandshakeResource -> Rep HandshakeResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HandshakeResource x -> HandshakeResource
$cfrom :: forall x. HandshakeResource -> Rep HandshakeResource x
Prelude.Generic)
newHandshakeResource ::
HandshakeResource
newHandshakeResource :: HandshakeResource
newHandshakeResource =
HandshakeResource' :: Maybe (Sensitive Text)
-> Maybe [HandshakeResource]
-> Maybe HandshakeResourceType
-> HandshakeResource
HandshakeResource'
{ $sel:value:HandshakeResource' :: Maybe (Sensitive Text)
value = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:resources:HandshakeResource' :: Maybe [HandshakeResource]
resources = Maybe [HandshakeResource]
forall a. Maybe a
Prelude.Nothing,
$sel:type':HandshakeResource' :: Maybe HandshakeResourceType
type' = Maybe HandshakeResourceType
forall a. Maybe a
Prelude.Nothing
}
handshakeResource_value :: Lens.Lens' HandshakeResource (Prelude.Maybe Prelude.Text)
handshakeResource_value :: (Maybe Text -> f (Maybe Text))
-> HandshakeResource -> f HandshakeResource
handshakeResource_value = (HandshakeResource -> Maybe (Sensitive Text))
-> (HandshakeResource
-> Maybe (Sensitive Text) -> HandshakeResource)
-> Lens
HandshakeResource
HandshakeResource
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HandshakeResource' {Maybe (Sensitive Text)
value :: Maybe (Sensitive Text)
$sel:value:HandshakeResource' :: HandshakeResource -> Maybe (Sensitive Text)
value} -> Maybe (Sensitive Text)
value) (\s :: HandshakeResource
s@HandshakeResource' {} Maybe (Sensitive Text)
a -> HandshakeResource
s {$sel:value:HandshakeResource' :: Maybe (Sensitive Text)
value = Maybe (Sensitive Text)
a} :: HandshakeResource) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> HandshakeResource -> f HandshakeResource)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> HandshakeResource
-> f HandshakeResource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
handshakeResource_resources :: Lens.Lens' HandshakeResource (Prelude.Maybe [HandshakeResource])
handshakeResource_resources :: (Maybe [HandshakeResource] -> f (Maybe [HandshakeResource]))
-> HandshakeResource -> f HandshakeResource
handshakeResource_resources = (HandshakeResource -> Maybe [HandshakeResource])
-> (HandshakeResource
-> Maybe [HandshakeResource] -> HandshakeResource)
-> Lens
HandshakeResource
HandshakeResource
(Maybe [HandshakeResource])
(Maybe [HandshakeResource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HandshakeResource' {Maybe [HandshakeResource]
resources :: Maybe [HandshakeResource]
$sel:resources:HandshakeResource' :: HandshakeResource -> Maybe [HandshakeResource]
resources} -> Maybe [HandshakeResource]
resources) (\s :: HandshakeResource
s@HandshakeResource' {} Maybe [HandshakeResource]
a -> HandshakeResource
s {$sel:resources:HandshakeResource' :: Maybe [HandshakeResource]
resources = Maybe [HandshakeResource]
a} :: HandshakeResource) ((Maybe [HandshakeResource] -> f (Maybe [HandshakeResource]))
-> HandshakeResource -> f HandshakeResource)
-> ((Maybe [HandshakeResource] -> f (Maybe [HandshakeResource]))
-> Maybe [HandshakeResource] -> f (Maybe [HandshakeResource]))
-> (Maybe [HandshakeResource] -> f (Maybe [HandshakeResource]))
-> HandshakeResource
-> f HandshakeResource
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
handshakeResource_type :: Lens.Lens' HandshakeResource (Prelude.Maybe HandshakeResourceType)
handshakeResource_type :: (Maybe HandshakeResourceType -> f (Maybe HandshakeResourceType))
-> HandshakeResource -> f HandshakeResource
handshakeResource_type = (HandshakeResource -> Maybe HandshakeResourceType)
-> (HandshakeResource
-> Maybe HandshakeResourceType -> HandshakeResource)
-> Lens
HandshakeResource
HandshakeResource
(Maybe HandshakeResourceType)
(Maybe HandshakeResourceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HandshakeResource' {Maybe HandshakeResourceType
type' :: Maybe HandshakeResourceType
$sel:type':HandshakeResource' :: HandshakeResource -> Maybe HandshakeResourceType
type'} -> Maybe HandshakeResourceType
type') (\s :: HandshakeResource
s@HandshakeResource' {} Maybe HandshakeResourceType
a -> HandshakeResource
s {$sel:type':HandshakeResource' :: Maybe HandshakeResourceType
type' = Maybe HandshakeResourceType
a} :: HandshakeResource)
instance Core.FromJSON HandshakeResource where
parseJSON :: Value -> Parser HandshakeResource
parseJSON =
String
-> (Object -> Parser HandshakeResource)
-> Value
-> Parser HandshakeResource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"HandshakeResource"
( \Object
x ->
Maybe (Sensitive Text)
-> Maybe [HandshakeResource]
-> Maybe HandshakeResourceType
-> HandshakeResource
HandshakeResource'
(Maybe (Sensitive Text)
-> Maybe [HandshakeResource]
-> Maybe HandshakeResourceType
-> HandshakeResource)
-> Parser (Maybe (Sensitive Text))
-> Parser
(Maybe [HandshakeResource]
-> Maybe HandshakeResourceType -> HandshakeResource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
Parser
(Maybe [HandshakeResource]
-> Maybe HandshakeResourceType -> HandshakeResource)
-> Parser (Maybe [HandshakeResource])
-> Parser (Maybe HandshakeResourceType -> HandshakeResource)
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 HandshakeResourceType -> HandshakeResource)
-> Parser (Maybe HandshakeResourceType) -> Parser HandshakeResource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe HandshakeResourceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
)
instance Prelude.Hashable HandshakeResource
instance Prelude.NFData HandshakeResource