{-# 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.Child where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Organizations.Types.ChildType
import qualified Amazonka.Prelude as Prelude
data Child = Child'
{
Child -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
Child -> Maybe ChildType
type' :: Prelude.Maybe ChildType
}
deriving (Child -> Child -> Bool
(Child -> Child -> Bool) -> (Child -> Child -> Bool) -> Eq Child
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Child -> Child -> Bool
$c/= :: Child -> Child -> Bool
== :: Child -> Child -> Bool
$c== :: Child -> Child -> Bool
Prelude.Eq, ReadPrec [Child]
ReadPrec Child
Int -> ReadS Child
ReadS [Child]
(Int -> ReadS Child)
-> ReadS [Child]
-> ReadPrec Child
-> ReadPrec [Child]
-> Read Child
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Child]
$creadListPrec :: ReadPrec [Child]
readPrec :: ReadPrec Child
$creadPrec :: ReadPrec Child
readList :: ReadS [Child]
$creadList :: ReadS [Child]
readsPrec :: Int -> ReadS Child
$creadsPrec :: Int -> ReadS Child
Prelude.Read, Int -> Child -> ShowS
[Child] -> ShowS
Child -> String
(Int -> Child -> ShowS)
-> (Child -> String) -> ([Child] -> ShowS) -> Show Child
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Child] -> ShowS
$cshowList :: [Child] -> ShowS
show :: Child -> String
$cshow :: Child -> String
showsPrec :: Int -> Child -> ShowS
$cshowsPrec :: Int -> Child -> ShowS
Prelude.Show, (forall x. Child -> Rep Child x)
-> (forall x. Rep Child x -> Child) -> Generic Child
forall x. Rep Child x -> Child
forall x. Child -> Rep Child x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Child x -> Child
$cfrom :: forall x. Child -> Rep Child x
Prelude.Generic)
newChild ::
Child
newChild :: Child
newChild =
Child' :: Maybe Text -> Maybe ChildType -> Child
Child'
{ $sel:id:Child' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:type':Child' :: Maybe ChildType
type' = Maybe ChildType
forall a. Maybe a
Prelude.Nothing
}
child_id :: Lens.Lens' Child (Prelude.Maybe Prelude.Text)
child_id :: (Maybe Text -> f (Maybe Text)) -> Child -> f Child
child_id = (Child -> Maybe Text)
-> (Child -> Maybe Text -> Child)
-> Lens Child Child (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Child' {Maybe Text
id :: Maybe Text
$sel:id:Child' :: Child -> Maybe Text
id} -> Maybe Text
id) (\s :: Child
s@Child' {} Maybe Text
a -> Child
s {$sel:id:Child' :: Maybe Text
id = Maybe Text
a} :: Child)
child_type :: Lens.Lens' Child (Prelude.Maybe ChildType)
child_type :: (Maybe ChildType -> f (Maybe ChildType)) -> Child -> f Child
child_type = (Child -> Maybe ChildType)
-> (Child -> Maybe ChildType -> Child)
-> Lens Child Child (Maybe ChildType) (Maybe ChildType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Child' {Maybe ChildType
type' :: Maybe ChildType
$sel:type':Child' :: Child -> Maybe ChildType
type'} -> Maybe ChildType
type') (\s :: Child
s@Child' {} Maybe ChildType
a -> Child
s {$sel:type':Child' :: Maybe ChildType
type' = Maybe ChildType
a} :: Child)
instance Core.FromJSON Child where
parseJSON :: Value -> Parser Child
parseJSON =
String -> (Object -> Parser Child) -> Value -> Parser Child
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Child"
( \Object
x ->
Maybe Text -> Maybe ChildType -> Child
Child'
(Maybe Text -> Maybe ChildType -> Child)
-> Parser (Maybe Text) -> Parser (Maybe ChildType -> Child)
forall (f :: * -> *) a b. Functor 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 ChildType -> Child)
-> Parser (Maybe ChildType) -> Parser Child
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ChildType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
)
instance Prelude.Hashable Child
instance Prelude.NFData Child