{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
id :: Prelude.Maybe Prelude.Text,
Root -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
Root -> Maybe [PolicyTypeSummary]
policyTypes :: Prelude.Maybe [PolicyTypeSummary]
}
deriving (Root -> Root -> Bool
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]
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
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. 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'
{ $sel:arn:Root' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
$sel:id:Root' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
$sel:name:Root' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:policyTypes:Root' :: Maybe [PolicyTypeSummary]
policyTypes = forall a. Maybe a
Prelude.Nothing
}
root_arn :: Lens.Lens' Root (Prelude.Maybe Prelude.Text)
root_arn :: Lens' Root (Maybe Text)
root_arn = 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_id :: Lens.Lens' Root (Prelude.Maybe Prelude.Text)
root_id :: Lens' Root (Maybe Text)
root_id = 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_name :: Lens.Lens' Root (Prelude.Maybe Prelude.Text)
root_name :: Lens' Root (Maybe Text)
root_name = 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_policyTypes :: Lens.Lens' Root (Prelude.Maybe [PolicyTypeSummary])
root_policyTypes :: Lens' Root (Maybe [PolicyTypeSummary])
root_policyTypes = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON Root where
parseJSON :: Value -> Parser Root
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"Root"
( \Object
x ->
Maybe Text
-> Maybe Text -> Maybe Text -> Maybe [PolicyTypeSummary] -> Root
Root'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Arn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Id")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PolicyTypes" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Root where
hashWithSalt :: Int -> Root -> Int
hashWithSalt Int
_salt Root' {Maybe [PolicyTypeSummary]
Maybe Text
policyTypes :: Maybe [PolicyTypeSummary]
name :: Maybe Text
id :: Maybe Text
arn :: Maybe Text
$sel:policyTypes:Root' :: Root -> Maybe [PolicyTypeSummary]
$sel:name:Root' :: Root -> Maybe Text
$sel:id:Root' :: Root -> Maybe Text
$sel:arn:Root' :: Root -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PolicyTypeSummary]
policyTypes
instance Prelude.NFData Root where
rnf :: Root -> ()
rnf Root' {Maybe [PolicyTypeSummary]
Maybe Text
policyTypes :: Maybe [PolicyTypeSummary]
name :: Maybe Text
id :: Maybe Text
arn :: Maybe Text
$sel:policyTypes:Root' :: Root -> Maybe [PolicyTypeSummary]
$sel:name:Root' :: Root -> Maybe Text
$sel:id:Root' :: Root -> Maybe Text
$sel:arn:Root' :: Root -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PolicyTypeSummary]
policyTypes