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