{-# 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.Root where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Organizations.Types.PolicyTypeSummary
import qualified Amazonka.Prelude as Prelude
data Root = Root'
{
Root -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
Root -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Root -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
Root -> Maybe [PolicyTypeSummary]
policyTypes :: Prelude.Maybe [PolicyTypeSummary]
}
deriving (Root -> Root -> Bool
(Root -> Root -> Bool) -> (Root -> Root -> Bool) -> Eq Root
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Root -> Root -> Bool
$c/= :: Root -> Root -> Bool
== :: Root -> Root -> Bool
$c== :: Root -> Root -> Bool
Prelude.Eq, ReadPrec [Root]
ReadPrec Root
Int -> ReadS Root
ReadS [Root]
(Int -> ReadS Root)
-> ReadS [Root] -> ReadPrec Root -> ReadPrec [Root] -> Read Root
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Root]
$creadListPrec :: ReadPrec [Root]
readPrec :: ReadPrec Root
$creadPrec :: ReadPrec Root
readList :: ReadS [Root]
$creadList :: ReadS [Root]
readsPrec :: Int -> ReadS Root
$creadsPrec :: Int -> ReadS Root
Prelude.Read, Int -> Root -> ShowS
[Root] -> ShowS
Root -> String
(Int -> Root -> ShowS)
-> (Root -> String) -> ([Root] -> ShowS) -> Show Root
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Root] -> ShowS
$cshowList :: [Root] -> ShowS
show :: Root -> String
$cshow :: Root -> String
showsPrec :: Int -> Root -> ShowS
$cshowsPrec :: Int -> Root -> ShowS
Prelude.Show, (forall x. Root -> Rep Root x)
-> (forall x. Rep Root x -> Root) -> Generic Root
forall x. Rep Root x -> Root
forall x. Root -> Rep Root x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Root x -> Root
$cfrom :: forall x. Root -> Rep Root x
Prelude.Generic)
newRoot ::
Root
newRoot :: Root
newRoot =
Root' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe [PolicyTypeSummary] -> Root
Root'
{ $sel:arn:Root' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:Root' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:Root' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policyTypes:Root' :: Maybe [PolicyTypeSummary]
policyTypes = Maybe [PolicyTypeSummary]
forall a. Maybe a
Prelude.Nothing
}
root_arn :: Lens.Lens' Root (Prelude.Maybe Prelude.Text)
root_arn :: (Maybe Text -> f (Maybe Text)) -> Root -> f Root
root_arn = (Root -> Maybe Text)
-> (Root -> Maybe Text -> Root)
-> Lens Root Root (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Root' {Maybe Text
arn :: Maybe Text
$sel:arn:Root' :: Root -> Maybe Text
arn} -> Maybe Text
arn) (\s :: Root
s@Root' {} Maybe Text
a -> Root
s {$sel:arn:Root' :: Maybe Text
arn = Maybe Text
a} :: Root)
root_name :: Lens.Lens' Root (Prelude.Maybe Prelude.Text)
root_name :: (Maybe Text -> f (Maybe Text)) -> Root -> f Root
root_name = (Root -> Maybe Text)
-> (Root -> Maybe Text -> Root)
-> Lens Root Root (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Root' {Maybe Text
name :: Maybe Text
$sel:name:Root' :: Root -> Maybe Text
name} -> Maybe Text
name) (\s :: Root
s@Root' {} Maybe Text
a -> Root
s {$sel:name:Root' :: Maybe Text
name = Maybe Text
a} :: Root)
root_id :: Lens.Lens' Root (Prelude.Maybe Prelude.Text)
root_id :: (Maybe Text -> f (Maybe Text)) -> Root -> f Root
root_id = (Root -> Maybe Text)
-> (Root -> Maybe Text -> Root)
-> Lens Root Root (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Root' {Maybe Text
id :: Maybe Text
$sel:id:Root' :: Root -> Maybe Text
id} -> Maybe Text
id) (\s :: Root
s@Root' {} Maybe Text
a -> Root
s {$sel:id:Root' :: Maybe Text
id = Maybe Text
a} :: Root)
root_policyTypes :: Lens.Lens' Root (Prelude.Maybe [PolicyTypeSummary])
root_policyTypes :: (Maybe [PolicyTypeSummary] -> f (Maybe [PolicyTypeSummary]))
-> Root -> f Root
root_policyTypes = (Root -> Maybe [PolicyTypeSummary])
-> (Root -> Maybe [PolicyTypeSummary] -> Root)
-> Lens
Root Root (Maybe [PolicyTypeSummary]) (Maybe [PolicyTypeSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Root' {Maybe [PolicyTypeSummary]
policyTypes :: Maybe [PolicyTypeSummary]
$sel:policyTypes:Root' :: Root -> Maybe [PolicyTypeSummary]
policyTypes} -> Maybe [PolicyTypeSummary]
policyTypes) (\s :: Root
s@Root' {} Maybe [PolicyTypeSummary]
a -> Root
s {$sel:policyTypes:Root' :: Maybe [PolicyTypeSummary]
policyTypes = Maybe [PolicyTypeSummary]
a} :: Root) ((Maybe [PolicyTypeSummary] -> f (Maybe [PolicyTypeSummary]))
-> Root -> f Root)
-> ((Maybe [PolicyTypeSummary] -> f (Maybe [PolicyTypeSummary]))
-> Maybe [PolicyTypeSummary] -> f (Maybe [PolicyTypeSummary]))
-> (Maybe [PolicyTypeSummary] -> f (Maybe [PolicyTypeSummary]))
-> Root
-> f Root
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PolicyTypeSummary]
[PolicyTypeSummary]
[PolicyTypeSummary]
[PolicyTypeSummary]
-> Iso
(Maybe [PolicyTypeSummary])
(Maybe [PolicyTypeSummary])
(Maybe [PolicyTypeSummary])
(Maybe [PolicyTypeSummary])
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
[PolicyTypeSummary]
[PolicyTypeSummary]
[PolicyTypeSummary]
[PolicyTypeSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Root where
parseJSON :: Value -> Parser Root
parseJSON =
String -> (Object -> Parser Root) -> Value -> Parser Root
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Root"
( \Object
x ->
Maybe Text
-> Maybe Text -> Maybe Text -> Maybe [PolicyTypeSummary] -> Root
Root'
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe [PolicyTypeSummary] -> Root)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> Maybe [PolicyTypeSummary] -> Root)
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
"Arn")
Parser
(Maybe Text -> Maybe Text -> Maybe [PolicyTypeSummary] -> Root)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe [PolicyTypeSummary] -> Root)
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
"Name")
Parser (Maybe Text -> Maybe [PolicyTypeSummary] -> Root)
-> Parser (Maybe Text)
-> Parser (Maybe [PolicyTypeSummary] -> Root)
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 [PolicyTypeSummary] -> Root)
-> Parser (Maybe [PolicyTypeSummary]) -> Parser Root
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [PolicyTypeSummary]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PolicyTypes" Parser (Maybe (Maybe [PolicyTypeSummary]))
-> Maybe [PolicyTypeSummary] -> Parser (Maybe [PolicyTypeSummary])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PolicyTypeSummary]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Root
instance Prelude.NFData Root