{-# 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.SSOAdmin.Types.AccessControlAttribute where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSOAdmin.Types.AccessControlAttributeValue
data AccessControlAttribute = AccessControlAttribute'
{
AccessControlAttribute -> Text
key :: Prelude.Text,
AccessControlAttribute -> AccessControlAttributeValue
value :: AccessControlAttributeValue
}
deriving (AccessControlAttribute -> AccessControlAttribute -> Bool
(AccessControlAttribute -> AccessControlAttribute -> Bool)
-> (AccessControlAttribute -> AccessControlAttribute -> Bool)
-> Eq AccessControlAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccessControlAttribute -> AccessControlAttribute -> Bool
$c/= :: AccessControlAttribute -> AccessControlAttribute -> Bool
== :: AccessControlAttribute -> AccessControlAttribute -> Bool
$c== :: AccessControlAttribute -> AccessControlAttribute -> Bool
Prelude.Eq, ReadPrec [AccessControlAttribute]
ReadPrec AccessControlAttribute
Int -> ReadS AccessControlAttribute
ReadS [AccessControlAttribute]
(Int -> ReadS AccessControlAttribute)
-> ReadS [AccessControlAttribute]
-> ReadPrec AccessControlAttribute
-> ReadPrec [AccessControlAttribute]
-> Read AccessControlAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccessControlAttribute]
$creadListPrec :: ReadPrec [AccessControlAttribute]
readPrec :: ReadPrec AccessControlAttribute
$creadPrec :: ReadPrec AccessControlAttribute
readList :: ReadS [AccessControlAttribute]
$creadList :: ReadS [AccessControlAttribute]
readsPrec :: Int -> ReadS AccessControlAttribute
$creadsPrec :: Int -> ReadS AccessControlAttribute
Prelude.Read, Int -> AccessControlAttribute -> ShowS
[AccessControlAttribute] -> ShowS
AccessControlAttribute -> String
(Int -> AccessControlAttribute -> ShowS)
-> (AccessControlAttribute -> String)
-> ([AccessControlAttribute] -> ShowS)
-> Show AccessControlAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccessControlAttribute] -> ShowS
$cshowList :: [AccessControlAttribute] -> ShowS
show :: AccessControlAttribute -> String
$cshow :: AccessControlAttribute -> String
showsPrec :: Int -> AccessControlAttribute -> ShowS
$cshowsPrec :: Int -> AccessControlAttribute -> ShowS
Prelude.Show, (forall x. AccessControlAttribute -> Rep AccessControlAttribute x)
-> (forall x.
Rep AccessControlAttribute x -> AccessControlAttribute)
-> Generic AccessControlAttribute
forall x. Rep AccessControlAttribute x -> AccessControlAttribute
forall x. AccessControlAttribute -> Rep AccessControlAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccessControlAttribute x -> AccessControlAttribute
$cfrom :: forall x. AccessControlAttribute -> Rep AccessControlAttribute x
Prelude.Generic)
newAccessControlAttribute ::
Prelude.Text ->
AccessControlAttributeValue ->
AccessControlAttribute
newAccessControlAttribute :: Text -> AccessControlAttributeValue -> AccessControlAttribute
newAccessControlAttribute Text
pKey_ AccessControlAttributeValue
pValue_ =
AccessControlAttribute' :: Text -> AccessControlAttributeValue -> AccessControlAttribute
AccessControlAttribute'
{ $sel:key:AccessControlAttribute' :: Text
key = Text
pKey_,
$sel:value:AccessControlAttribute' :: AccessControlAttributeValue
value = AccessControlAttributeValue
pValue_
}
accessControlAttribute_key :: Lens.Lens' AccessControlAttribute Prelude.Text
accessControlAttribute_key :: (Text -> f Text)
-> AccessControlAttribute -> f AccessControlAttribute
accessControlAttribute_key = (AccessControlAttribute -> Text)
-> (AccessControlAttribute -> Text -> AccessControlAttribute)
-> Lens AccessControlAttribute AccessControlAttribute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessControlAttribute' {Text
key :: Text
$sel:key:AccessControlAttribute' :: AccessControlAttribute -> Text
key} -> Text
key) (\s :: AccessControlAttribute
s@AccessControlAttribute' {} Text
a -> AccessControlAttribute
s {$sel:key:AccessControlAttribute' :: Text
key = Text
a} :: AccessControlAttribute)
accessControlAttribute_value :: Lens.Lens' AccessControlAttribute AccessControlAttributeValue
accessControlAttribute_value :: (AccessControlAttributeValue -> f AccessControlAttributeValue)
-> AccessControlAttribute -> f AccessControlAttribute
accessControlAttribute_value = (AccessControlAttribute -> AccessControlAttributeValue)
-> (AccessControlAttribute
-> AccessControlAttributeValue -> AccessControlAttribute)
-> Lens
AccessControlAttribute
AccessControlAttribute
AccessControlAttributeValue
AccessControlAttributeValue
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccessControlAttribute' {AccessControlAttributeValue
value :: AccessControlAttributeValue
$sel:value:AccessControlAttribute' :: AccessControlAttribute -> AccessControlAttributeValue
value} -> AccessControlAttributeValue
value) (\s :: AccessControlAttribute
s@AccessControlAttribute' {} AccessControlAttributeValue
a -> AccessControlAttribute
s {$sel:value:AccessControlAttribute' :: AccessControlAttributeValue
value = AccessControlAttributeValue
a} :: AccessControlAttribute)
instance Core.FromJSON AccessControlAttribute where
parseJSON :: Value -> Parser AccessControlAttribute
parseJSON =
String
-> (Object -> Parser AccessControlAttribute)
-> Value
-> Parser AccessControlAttribute
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AccessControlAttribute"
( \Object
x ->
Text -> AccessControlAttributeValue -> AccessControlAttribute
AccessControlAttribute'
(Text -> AccessControlAttributeValue -> AccessControlAttribute)
-> Parser Text
-> Parser (AccessControlAttributeValue -> AccessControlAttribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Key") Parser (AccessControlAttributeValue -> AccessControlAttribute)
-> Parser AccessControlAttributeValue
-> Parser AccessControlAttribute
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser AccessControlAttributeValue
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Value")
)
instance Prelude.Hashable AccessControlAttribute
instance Prelude.NFData AccessControlAttribute
instance Core.ToJSON AccessControlAttribute where
toJSON :: AccessControlAttribute -> Value
toJSON AccessControlAttribute' {Text
AccessControlAttributeValue
value :: AccessControlAttributeValue
key :: Text
$sel:value:AccessControlAttribute' :: AccessControlAttribute -> AccessControlAttributeValue
$sel:key:AccessControlAttribute' :: AccessControlAttribute -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
key),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> AccessControlAttributeValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AccessControlAttributeValue
value)
]
)