{-# 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.CloudDirectory.Types.PolicyToPath where
import Amazonka.CloudDirectory.Types.PolicyAttachment
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PolicyToPath = PolicyToPath'
{
PolicyToPath -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
PolicyToPath -> Maybe [PolicyAttachment]
policies :: Prelude.Maybe [PolicyAttachment]
}
deriving (PolicyToPath -> PolicyToPath -> Bool
(PolicyToPath -> PolicyToPath -> Bool)
-> (PolicyToPath -> PolicyToPath -> Bool) -> Eq PolicyToPath
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PolicyToPath -> PolicyToPath -> Bool
$c/= :: PolicyToPath -> PolicyToPath -> Bool
== :: PolicyToPath -> PolicyToPath -> Bool
$c== :: PolicyToPath -> PolicyToPath -> Bool
Prelude.Eq, ReadPrec [PolicyToPath]
ReadPrec PolicyToPath
Int -> ReadS PolicyToPath
ReadS [PolicyToPath]
(Int -> ReadS PolicyToPath)
-> ReadS [PolicyToPath]
-> ReadPrec PolicyToPath
-> ReadPrec [PolicyToPath]
-> Read PolicyToPath
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PolicyToPath]
$creadListPrec :: ReadPrec [PolicyToPath]
readPrec :: ReadPrec PolicyToPath
$creadPrec :: ReadPrec PolicyToPath
readList :: ReadS [PolicyToPath]
$creadList :: ReadS [PolicyToPath]
readsPrec :: Int -> ReadS PolicyToPath
$creadsPrec :: Int -> ReadS PolicyToPath
Prelude.Read, Int -> PolicyToPath -> ShowS
[PolicyToPath] -> ShowS
PolicyToPath -> String
(Int -> PolicyToPath -> ShowS)
-> (PolicyToPath -> String)
-> ([PolicyToPath] -> ShowS)
-> Show PolicyToPath
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PolicyToPath] -> ShowS
$cshowList :: [PolicyToPath] -> ShowS
show :: PolicyToPath -> String
$cshow :: PolicyToPath -> String
showsPrec :: Int -> PolicyToPath -> ShowS
$cshowsPrec :: Int -> PolicyToPath -> ShowS
Prelude.Show, (forall x. PolicyToPath -> Rep PolicyToPath x)
-> (forall x. Rep PolicyToPath x -> PolicyToPath)
-> Generic PolicyToPath
forall x. Rep PolicyToPath x -> PolicyToPath
forall x. PolicyToPath -> Rep PolicyToPath x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PolicyToPath x -> PolicyToPath
$cfrom :: forall x. PolicyToPath -> Rep PolicyToPath x
Prelude.Generic)
newPolicyToPath ::
PolicyToPath
newPolicyToPath :: PolicyToPath
newPolicyToPath =
PolicyToPath' :: Maybe Text -> Maybe [PolicyAttachment] -> PolicyToPath
PolicyToPath'
{ $sel:path:PolicyToPath' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:policies:PolicyToPath' :: Maybe [PolicyAttachment]
policies = Maybe [PolicyAttachment]
forall a. Maybe a
Prelude.Nothing
}
policyToPath_path :: Lens.Lens' PolicyToPath (Prelude.Maybe Prelude.Text)
policyToPath_path :: (Maybe Text -> f (Maybe Text)) -> PolicyToPath -> f PolicyToPath
policyToPath_path = (PolicyToPath -> Maybe Text)
-> (PolicyToPath -> Maybe Text -> PolicyToPath)
-> Lens PolicyToPath PolicyToPath (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyToPath' {Maybe Text
path :: Maybe Text
$sel:path:PolicyToPath' :: PolicyToPath -> Maybe Text
path} -> Maybe Text
path) (\s :: PolicyToPath
s@PolicyToPath' {} Maybe Text
a -> PolicyToPath
s {$sel:path:PolicyToPath' :: Maybe Text
path = Maybe Text
a} :: PolicyToPath)
policyToPath_policies :: Lens.Lens' PolicyToPath (Prelude.Maybe [PolicyAttachment])
policyToPath_policies :: (Maybe [PolicyAttachment] -> f (Maybe [PolicyAttachment]))
-> PolicyToPath -> f PolicyToPath
policyToPath_policies = (PolicyToPath -> Maybe [PolicyAttachment])
-> (PolicyToPath -> Maybe [PolicyAttachment] -> PolicyToPath)
-> Lens
PolicyToPath
PolicyToPath
(Maybe [PolicyAttachment])
(Maybe [PolicyAttachment])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PolicyToPath' {Maybe [PolicyAttachment]
policies :: Maybe [PolicyAttachment]
$sel:policies:PolicyToPath' :: PolicyToPath -> Maybe [PolicyAttachment]
policies} -> Maybe [PolicyAttachment]
policies) (\s :: PolicyToPath
s@PolicyToPath' {} Maybe [PolicyAttachment]
a -> PolicyToPath
s {$sel:policies:PolicyToPath' :: Maybe [PolicyAttachment]
policies = Maybe [PolicyAttachment]
a} :: PolicyToPath) ((Maybe [PolicyAttachment] -> f (Maybe [PolicyAttachment]))
-> PolicyToPath -> f PolicyToPath)
-> ((Maybe [PolicyAttachment] -> f (Maybe [PolicyAttachment]))
-> Maybe [PolicyAttachment] -> f (Maybe [PolicyAttachment]))
-> (Maybe [PolicyAttachment] -> f (Maybe [PolicyAttachment]))
-> PolicyToPath
-> f PolicyToPath
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PolicyAttachment]
[PolicyAttachment]
[PolicyAttachment]
[PolicyAttachment]
-> Iso
(Maybe [PolicyAttachment])
(Maybe [PolicyAttachment])
(Maybe [PolicyAttachment])
(Maybe [PolicyAttachment])
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
[PolicyAttachment]
[PolicyAttachment]
[PolicyAttachment]
[PolicyAttachment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON PolicyToPath where
parseJSON :: Value -> Parser PolicyToPath
parseJSON =
String
-> (Object -> Parser PolicyToPath) -> Value -> Parser PolicyToPath
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PolicyToPath"
( \Object
x ->
Maybe Text -> Maybe [PolicyAttachment] -> PolicyToPath
PolicyToPath'
(Maybe Text -> Maybe [PolicyAttachment] -> PolicyToPath)
-> Parser (Maybe Text)
-> Parser (Maybe [PolicyAttachment] -> PolicyToPath)
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
"Path")
Parser (Maybe [PolicyAttachment] -> PolicyToPath)
-> Parser (Maybe [PolicyAttachment]) -> Parser PolicyToPath
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [PolicyAttachment]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Policies" Parser (Maybe (Maybe [PolicyAttachment]))
-> Maybe [PolicyAttachment] -> Parser (Maybe [PolicyAttachment])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [PolicyAttachment]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable PolicyToPath
instance Prelude.NFData PolicyToPath