{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Config.GetStoredQuery
(
GetStoredQuery (..),
newGetStoredQuery,
getStoredQuery_queryName,
GetStoredQueryResponse (..),
newGetStoredQueryResponse,
getStoredQueryResponse_storedQuery,
getStoredQueryResponse_httpStatus,
)
where
import Amazonka.Config.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetStoredQuery = GetStoredQuery'
{
GetStoredQuery -> Text
queryName :: Prelude.Text
}
deriving (GetStoredQuery -> GetStoredQuery -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStoredQuery -> GetStoredQuery -> Bool
$c/= :: GetStoredQuery -> GetStoredQuery -> Bool
== :: GetStoredQuery -> GetStoredQuery -> Bool
$c== :: GetStoredQuery -> GetStoredQuery -> Bool
Prelude.Eq, ReadPrec [GetStoredQuery]
ReadPrec GetStoredQuery
Int -> ReadS GetStoredQuery
ReadS [GetStoredQuery]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStoredQuery]
$creadListPrec :: ReadPrec [GetStoredQuery]
readPrec :: ReadPrec GetStoredQuery
$creadPrec :: ReadPrec GetStoredQuery
readList :: ReadS [GetStoredQuery]
$creadList :: ReadS [GetStoredQuery]
readsPrec :: Int -> ReadS GetStoredQuery
$creadsPrec :: Int -> ReadS GetStoredQuery
Prelude.Read, Int -> GetStoredQuery -> ShowS
[GetStoredQuery] -> ShowS
GetStoredQuery -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStoredQuery] -> ShowS
$cshowList :: [GetStoredQuery] -> ShowS
show :: GetStoredQuery -> String
$cshow :: GetStoredQuery -> String
showsPrec :: Int -> GetStoredQuery -> ShowS
$cshowsPrec :: Int -> GetStoredQuery -> ShowS
Prelude.Show, forall x. Rep GetStoredQuery x -> GetStoredQuery
forall x. GetStoredQuery -> Rep GetStoredQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStoredQuery x -> GetStoredQuery
$cfrom :: forall x. GetStoredQuery -> Rep GetStoredQuery x
Prelude.Generic)
newGetStoredQuery ::
Prelude.Text ->
GetStoredQuery
newGetStoredQuery :: Text -> GetStoredQuery
newGetStoredQuery Text
pQueryName_ =
GetStoredQuery' {$sel:queryName:GetStoredQuery' :: Text
queryName = Text
pQueryName_}
getStoredQuery_queryName :: Lens.Lens' GetStoredQuery Prelude.Text
getStoredQuery_queryName :: Lens' GetStoredQuery Text
getStoredQuery_queryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStoredQuery' {Text
queryName :: Text
$sel:queryName:GetStoredQuery' :: GetStoredQuery -> Text
queryName} -> Text
queryName) (\s :: GetStoredQuery
s@GetStoredQuery' {} Text
a -> GetStoredQuery
s {$sel:queryName:GetStoredQuery' :: Text
queryName = Text
a} :: GetStoredQuery)
instance Core.AWSRequest GetStoredQuery where
type
AWSResponse GetStoredQuery =
GetStoredQueryResponse
request :: (Service -> Service) -> GetStoredQuery -> Request GetStoredQuery
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetStoredQuery
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStoredQuery)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe StoredQuery -> Int -> GetStoredQueryResponse
GetStoredQueryResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"StoredQuery")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetStoredQuery where
hashWithSalt :: Int -> GetStoredQuery -> Int
hashWithSalt Int
_salt GetStoredQuery' {Text
queryName :: Text
$sel:queryName:GetStoredQuery' :: GetStoredQuery -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
queryName
instance Prelude.NFData GetStoredQuery where
rnf :: GetStoredQuery -> ()
rnf GetStoredQuery' {Text
queryName :: Text
$sel:queryName:GetStoredQuery' :: GetStoredQuery -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
queryName
instance Data.ToHeaders GetStoredQuery where
toHeaders :: GetStoredQuery -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"StarlingDoveService.GetStoredQuery" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetStoredQuery where
toJSON :: GetStoredQuery -> Value
toJSON GetStoredQuery' {Text
queryName :: Text
$sel:queryName:GetStoredQuery' :: GetStoredQuery -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"QueryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
queryName)]
)
instance Data.ToPath GetStoredQuery where
toPath :: GetStoredQuery -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetStoredQuery where
toQuery :: GetStoredQuery -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetStoredQueryResponse = GetStoredQueryResponse'
{
GetStoredQueryResponse -> Maybe StoredQuery
storedQuery :: Prelude.Maybe StoredQuery,
GetStoredQueryResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetStoredQueryResponse -> GetStoredQueryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStoredQueryResponse -> GetStoredQueryResponse -> Bool
$c/= :: GetStoredQueryResponse -> GetStoredQueryResponse -> Bool
== :: GetStoredQueryResponse -> GetStoredQueryResponse -> Bool
$c== :: GetStoredQueryResponse -> GetStoredQueryResponse -> Bool
Prelude.Eq, ReadPrec [GetStoredQueryResponse]
ReadPrec GetStoredQueryResponse
Int -> ReadS GetStoredQueryResponse
ReadS [GetStoredQueryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStoredQueryResponse]
$creadListPrec :: ReadPrec [GetStoredQueryResponse]
readPrec :: ReadPrec GetStoredQueryResponse
$creadPrec :: ReadPrec GetStoredQueryResponse
readList :: ReadS [GetStoredQueryResponse]
$creadList :: ReadS [GetStoredQueryResponse]
readsPrec :: Int -> ReadS GetStoredQueryResponse
$creadsPrec :: Int -> ReadS GetStoredQueryResponse
Prelude.Read, Int -> GetStoredQueryResponse -> ShowS
[GetStoredQueryResponse] -> ShowS
GetStoredQueryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStoredQueryResponse] -> ShowS
$cshowList :: [GetStoredQueryResponse] -> ShowS
show :: GetStoredQueryResponse -> String
$cshow :: GetStoredQueryResponse -> String
showsPrec :: Int -> GetStoredQueryResponse -> ShowS
$cshowsPrec :: Int -> GetStoredQueryResponse -> ShowS
Prelude.Show, forall x. Rep GetStoredQueryResponse x -> GetStoredQueryResponse
forall x. GetStoredQueryResponse -> Rep GetStoredQueryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStoredQueryResponse x -> GetStoredQueryResponse
$cfrom :: forall x. GetStoredQueryResponse -> Rep GetStoredQueryResponse x
Prelude.Generic)
newGetStoredQueryResponse ::
Prelude.Int ->
GetStoredQueryResponse
newGetStoredQueryResponse :: Int -> GetStoredQueryResponse
newGetStoredQueryResponse Int
pHttpStatus_ =
GetStoredQueryResponse'
{ $sel:storedQuery:GetStoredQueryResponse' :: Maybe StoredQuery
storedQuery =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStoredQueryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStoredQueryResponse_storedQuery :: Lens.Lens' GetStoredQueryResponse (Prelude.Maybe StoredQuery)
getStoredQueryResponse_storedQuery :: Lens' GetStoredQueryResponse (Maybe StoredQuery)
getStoredQueryResponse_storedQuery = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStoredQueryResponse' {Maybe StoredQuery
storedQuery :: Maybe StoredQuery
$sel:storedQuery:GetStoredQueryResponse' :: GetStoredQueryResponse -> Maybe StoredQuery
storedQuery} -> Maybe StoredQuery
storedQuery) (\s :: GetStoredQueryResponse
s@GetStoredQueryResponse' {} Maybe StoredQuery
a -> GetStoredQueryResponse
s {$sel:storedQuery:GetStoredQueryResponse' :: Maybe StoredQuery
storedQuery = Maybe StoredQuery
a} :: GetStoredQueryResponse)
getStoredQueryResponse_httpStatus :: Lens.Lens' GetStoredQueryResponse Prelude.Int
getStoredQueryResponse_httpStatus :: Lens' GetStoredQueryResponse Int
getStoredQueryResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStoredQueryResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetStoredQueryResponse' :: GetStoredQueryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetStoredQueryResponse
s@GetStoredQueryResponse' {} Int
a -> GetStoredQueryResponse
s {$sel:httpStatus:GetStoredQueryResponse' :: Int
httpStatus = Int
a} :: GetStoredQueryResponse)
instance Prelude.NFData GetStoredQueryResponse where
rnf :: GetStoredQueryResponse -> ()
rnf GetStoredQueryResponse' {Int
Maybe StoredQuery
httpStatus :: Int
storedQuery :: Maybe StoredQuery
$sel:httpStatus:GetStoredQueryResponse' :: GetStoredQueryResponse -> Int
$sel:storedQuery:GetStoredQueryResponse' :: GetStoredQueryResponse -> Maybe StoredQuery
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe StoredQuery
storedQuery
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus