{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:path:PolicyToPath' :: Maybe Text
path = forall a. Maybe a
Prelude.Nothing,
$sel:policies:PolicyToPath' :: Maybe [PolicyAttachment]
policies = forall a. Maybe a
Prelude.Nothing
}
policyToPath_path :: Lens.Lens' PolicyToPath (Prelude.Maybe Prelude.Text)
policyToPath_path :: Lens' PolicyToPath (Maybe Text)
policyToPath_path = 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 :: Lens' PolicyToPath (Maybe [PolicyAttachment])
policyToPath_policies = 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) 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 PolicyToPath where
parseJSON :: Value -> Parser PolicyToPath
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"PolicyToPath"
( \Object
x ->
Maybe Text -> Maybe [PolicyAttachment] -> PolicyToPath
PolicyToPath'
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
"Path")
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
"Policies" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable PolicyToPath where
hashWithSalt :: Int -> PolicyToPath -> Int
hashWithSalt Int
_salt PolicyToPath' {Maybe [PolicyAttachment]
Maybe Text
policies :: Maybe [PolicyAttachment]
path :: Maybe Text
$sel:policies:PolicyToPath' :: PolicyToPath -> Maybe [PolicyAttachment]
$sel:path:PolicyToPath' :: PolicyToPath -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
path
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PolicyAttachment]
policies
instance Prelude.NFData PolicyToPath where
rnf :: PolicyToPath -> ()
rnf PolicyToPath' {Maybe [PolicyAttachment]
Maybe Text
policies :: Maybe [PolicyAttachment]
path :: Maybe Text
$sel:policies:PolicyToPath' :: PolicyToPath -> Maybe [PolicyAttachment]
$sel:path:PolicyToPath' :: PolicyToPath -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
path seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PolicyAttachment]
policies