{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data StoredQuery = StoredQuery'
{
StoredQuery -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
StoredQuery -> Maybe Text
expression :: Prelude.Maybe Prelude.Text,
StoredQuery -> Maybe Text
queryArn :: Prelude.Maybe Prelude.Text,
StoredQuery -> Maybe Text
queryId :: Prelude.Maybe Prelude.Text,
StoredQuery -> Text
queryName :: Prelude.Text
}
deriving (StoredQuery -> StoredQuery -> Bool
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]
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
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. 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'
{ $sel:description:StoredQuery' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:expression:StoredQuery' :: Maybe Text
expression = forall a. Maybe a
Prelude.Nothing,
$sel:queryArn:StoredQuery' :: Maybe Text
queryArn = forall a. Maybe a
Prelude.Nothing,
$sel:queryId:StoredQuery' :: Maybe Text
queryId = forall a. Maybe a
Prelude.Nothing,
$sel:queryName:StoredQuery' :: Text
queryName = Text
pQueryName_
}
storedQuery_description :: Lens.Lens' StoredQuery (Prelude.Maybe Prelude.Text)
storedQuery_description :: Lens' StoredQuery (Maybe Text)
storedQuery_description = 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_expression :: Lens.Lens' StoredQuery (Prelude.Maybe Prelude.Text)
storedQuery_expression :: Lens' StoredQuery (Maybe Text)
storedQuery_expression = 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_queryArn :: Lens.Lens' StoredQuery (Prelude.Maybe Prelude.Text)
storedQuery_queryArn :: Lens' StoredQuery (Maybe Text)
storedQuery_queryArn = 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_queryId :: Lens.Lens' StoredQuery (Prelude.Maybe Prelude.Text)
storedQuery_queryId :: Lens' StoredQuery (Maybe Text)
storedQuery_queryId = 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_queryName :: Lens.Lens' StoredQuery Prelude.Text
storedQuery_queryName :: Lens' StoredQuery Text
storedQuery_queryName = 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 Data.FromJSON StoredQuery where
parseJSON :: Value -> Parser StoredQuery
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"StoredQuery"
( \Object
x ->
Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Text -> StoredQuery
StoredQuery'
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
"Description")
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
"Expression")
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
"QueryArn")
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
"QueryId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"QueryName")
)
instance Prelude.Hashable StoredQuery where
hashWithSalt :: Int -> StoredQuery -> Int
hashWithSalt Int
_salt StoredQuery' {Maybe Text
Text
queryName :: Text
queryId :: Maybe Text
queryArn :: Maybe Text
expression :: Maybe Text
description :: Maybe Text
$sel:queryName:StoredQuery' :: StoredQuery -> Text
$sel:queryId:StoredQuery' :: StoredQuery -> Maybe Text
$sel:queryArn:StoredQuery' :: StoredQuery -> Maybe Text
$sel:expression:StoredQuery' :: StoredQuery -> Maybe Text
$sel:description:StoredQuery' :: StoredQuery -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
expression
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
queryArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
queryId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
queryName
instance Prelude.NFData StoredQuery where
rnf :: StoredQuery -> ()
rnf StoredQuery' {Maybe Text
Text
queryName :: Text
queryId :: Maybe Text
queryArn :: Maybe Text
expression :: Maybe Text
description :: Maybe Text
$sel:queryName:StoredQuery' :: StoredQuery -> Text
$sel:queryId:StoredQuery' :: StoredQuery -> Maybe Text
$sel:queryArn:StoredQuery' :: StoredQuery -> Maybe Text
$sel:expression:StoredQuery' :: StoredQuery -> Maybe Text
$sel:description:StoredQuery' :: StoredQuery -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
expression
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
queryArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
queryId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
queryName
instance Data.ToJSON StoredQuery where
toJSON :: StoredQuery -> Value
toJSON StoredQuery' {Maybe Text
Text
queryName :: Text
queryId :: Maybe Text
queryArn :: Maybe Text
expression :: Maybe Text
description :: Maybe Text
$sel:queryName:StoredQuery' :: StoredQuery -> Text
$sel:queryId:StoredQuery' :: StoredQuery -> Maybe Text
$sel:queryArn:StoredQuery' :: StoredQuery -> Maybe Text
$sel:expression:StoredQuery' :: StoredQuery -> Maybe Text
$sel:description:StoredQuery' :: StoredQuery -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Key
"Expression" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
expression,
(Key
"QueryArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
queryArn,
(Key
"QueryId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
queryId,
forall a. a -> Maybe a
Prelude.Just (Key
"QueryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
queryName)
]
)