{-# 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.Config.Types.StoredQuery where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data StoredQuery = StoredQuery'
{
StoredQuery -> Maybe Text
queryId :: Prelude.Maybe Prelude.Text,
StoredQuery -> Maybe Text
queryArn :: Prelude.Maybe Prelude.Text,
StoredQuery -> Maybe Text
expression :: Prelude.Maybe Prelude.Text,
StoredQuery -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
StoredQuery -> Text
queryName :: Prelude.Text
}
deriving (StoredQuery -> StoredQuery -> Bool
(StoredQuery -> StoredQuery -> Bool)
-> (StoredQuery -> StoredQuery -> Bool) -> Eq StoredQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StoredQuery -> StoredQuery -> Bool
$c/= :: StoredQuery -> StoredQuery -> Bool
== :: StoredQuery -> StoredQuery -> Bool
$c== :: StoredQuery -> StoredQuery -> Bool
Prelude.Eq, ReadPrec [StoredQuery]
ReadPrec StoredQuery
Int -> ReadS StoredQuery
ReadS [StoredQuery]
(Int -> ReadS StoredQuery)
-> ReadS [StoredQuery]
-> ReadPrec StoredQuery
-> ReadPrec [StoredQuery]
-> Read StoredQuery
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StoredQuery]
$creadListPrec :: ReadPrec [StoredQuery]
readPrec :: ReadPrec StoredQuery
$creadPrec :: ReadPrec StoredQuery
readList :: ReadS [StoredQuery]
$creadList :: ReadS [StoredQuery]
readsPrec :: Int -> ReadS StoredQuery
$creadsPrec :: Int -> ReadS StoredQuery
Prelude.Read, Int -> StoredQuery -> ShowS
[StoredQuery] -> ShowS
StoredQuery -> String
(Int -> StoredQuery -> ShowS)
-> (StoredQuery -> String)
-> ([StoredQuery] -> ShowS)
-> Show StoredQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StoredQuery] -> ShowS
$cshowList :: [StoredQuery] -> ShowS
show :: StoredQuery -> String
$cshow :: StoredQuery -> String
showsPrec :: Int -> StoredQuery -> ShowS
$cshowsPrec :: Int -> StoredQuery -> ShowS
Prelude.Show, (forall x. StoredQuery -> Rep StoredQuery x)
-> (forall x. Rep StoredQuery x -> StoredQuery)
-> Generic StoredQuery
forall x. Rep StoredQuery x -> StoredQuery
forall x. StoredQuery -> Rep StoredQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StoredQuery x -> StoredQuery
$cfrom :: forall x. StoredQuery -> Rep StoredQuery x
Prelude.Generic)
newStoredQuery ::
Prelude.Text ->
StoredQuery
newStoredQuery :: Text -> StoredQuery
newStoredQuery Text
pQueryName_ =
StoredQuery' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Text -> StoredQuery
StoredQuery'
{ $sel:queryId:StoredQuery' :: Maybe Text
queryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:queryArn:StoredQuery' :: Maybe Text
queryArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:expression:StoredQuery' :: Maybe Text
expression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:StoredQuery' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:queryName:StoredQuery' :: Text
queryName = Text
pQueryName_
}
storedQuery_queryId :: Lens.Lens' StoredQuery (Prelude.Maybe Prelude.Text)
storedQuery_queryId :: (Maybe Text -> f (Maybe Text)) -> StoredQuery -> f StoredQuery
storedQuery_queryId = (StoredQuery -> Maybe Text)
-> (StoredQuery -> Maybe Text -> StoredQuery)
-> Lens StoredQuery StoredQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoredQuery' {Maybe Text
queryId :: Maybe Text
$sel:queryId:StoredQuery' :: StoredQuery -> Maybe Text
queryId} -> Maybe Text
queryId) (\s :: StoredQuery
s@StoredQuery' {} Maybe Text
a -> StoredQuery
s {$sel:queryId:StoredQuery' :: Maybe Text
queryId = Maybe Text
a} :: StoredQuery)
storedQuery_queryArn :: Lens.Lens' StoredQuery (Prelude.Maybe Prelude.Text)
storedQuery_queryArn :: (Maybe Text -> f (Maybe Text)) -> StoredQuery -> f StoredQuery
storedQuery_queryArn = (StoredQuery -> Maybe Text)
-> (StoredQuery -> Maybe Text -> StoredQuery)
-> Lens StoredQuery StoredQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoredQuery' {Maybe Text
queryArn :: Maybe Text
$sel:queryArn:StoredQuery' :: StoredQuery -> Maybe Text
queryArn} -> Maybe Text
queryArn) (\s :: StoredQuery
s@StoredQuery' {} Maybe Text
a -> StoredQuery
s {$sel:queryArn:StoredQuery' :: Maybe Text
queryArn = Maybe Text
a} :: StoredQuery)
storedQuery_expression :: Lens.Lens' StoredQuery (Prelude.Maybe Prelude.Text)
storedQuery_expression :: (Maybe Text -> f (Maybe Text)) -> StoredQuery -> f StoredQuery
storedQuery_expression = (StoredQuery -> Maybe Text)
-> (StoredQuery -> Maybe Text -> StoredQuery)
-> Lens StoredQuery StoredQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoredQuery' {Maybe Text
expression :: Maybe Text
$sel:expression:StoredQuery' :: StoredQuery -> Maybe Text
expression} -> Maybe Text
expression) (\s :: StoredQuery
s@StoredQuery' {} Maybe Text
a -> StoredQuery
s {$sel:expression:StoredQuery' :: Maybe Text
expression = Maybe Text
a} :: StoredQuery)
storedQuery_description :: Lens.Lens' StoredQuery (Prelude.Maybe Prelude.Text)
storedQuery_description :: (Maybe Text -> f (Maybe Text)) -> StoredQuery -> f StoredQuery
storedQuery_description = (StoredQuery -> Maybe Text)
-> (StoredQuery -> Maybe Text -> StoredQuery)
-> Lens StoredQuery StoredQuery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoredQuery' {Maybe Text
description :: Maybe Text
$sel:description:StoredQuery' :: StoredQuery -> Maybe Text
description} -> Maybe Text
description) (\s :: StoredQuery
s@StoredQuery' {} Maybe Text
a -> StoredQuery
s {$sel:description:StoredQuery' :: Maybe Text
description = Maybe Text
a} :: StoredQuery)
storedQuery_queryName :: Lens.Lens' StoredQuery Prelude.Text
storedQuery_queryName :: (Text -> f Text) -> StoredQuery -> f StoredQuery
storedQuery_queryName = (StoredQuery -> Text)
-> (StoredQuery -> Text -> StoredQuery)
-> Lens StoredQuery StoredQuery Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoredQuery' {Text
queryName :: Text
$sel:queryName:StoredQuery' :: StoredQuery -> Text
queryName} -> Text
queryName) (\s :: StoredQuery
s@StoredQuery' {} Text
a -> StoredQuery
s {$sel:queryName:StoredQuery' :: Text
queryName = Text
a} :: StoredQuery)
instance Core.FromJSON StoredQuery where
parseJSON :: Value -> Parser StoredQuery
parseJSON =
String
-> (Object -> Parser StoredQuery) -> Value -> Parser StoredQuery
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"StoredQuery"
( \Object
x ->
Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Text -> StoredQuery
StoredQuery'
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Text -> StoredQuery)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> Maybe Text -> Text -> StoredQuery)
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
"QueryId")
Parser
(Maybe Text -> Maybe Text -> Maybe Text -> Text -> StoredQuery)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Text -> StoredQuery)
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
"QueryArn")
Parser (Maybe Text -> Maybe Text -> Text -> StoredQuery)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> StoredQuery)
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
"Expression")
Parser (Maybe Text -> Text -> StoredQuery)
-> Parser (Maybe Text) -> Parser (Text -> StoredQuery)
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
"Description")
Parser (Text -> StoredQuery) -> Parser Text -> Parser StoredQuery
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"QueryName")
)
instance Prelude.Hashable StoredQuery
instance Prelude.NFData StoredQuery
instance Core.ToJSON StoredQuery where
toJSON :: StoredQuery -> Value
toJSON StoredQuery' {Maybe Text
Text
queryName :: Text
description :: Maybe Text
expression :: Maybe Text
queryArn :: Maybe Text
queryId :: Maybe Text
$sel:queryName:StoredQuery' :: StoredQuery -> Text
$sel:description:StoredQuery' :: StoredQuery -> Maybe Text
$sel:expression:StoredQuery' :: StoredQuery -> Maybe Text
$sel:queryArn:StoredQuery' :: StoredQuery -> Maybe Text
$sel:queryId:StoredQuery' :: StoredQuery -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"QueryId" 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
queryId,
(Text
"QueryArn" 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
queryArn,
(Text
"Expression" 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
expression,
(Text
"Description" 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
description,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"QueryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryName)
]
)