{-# 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.Lens as Lens
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
(GetStoredQuery -> GetStoredQuery -> Bool)
-> (GetStoredQuery -> GetStoredQuery -> Bool) -> Eq GetStoredQuery
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]
(Int -> ReadS GetStoredQuery)
-> ReadS [GetStoredQuery]
-> ReadPrec GetStoredQuery
-> ReadPrec [GetStoredQuery]
-> Read 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
(Int -> GetStoredQuery -> ShowS)
-> (GetStoredQuery -> String)
-> ([GetStoredQuery] -> ShowS)
-> Show GetStoredQuery
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. GetStoredQuery -> Rep GetStoredQuery x)
-> (forall x. Rep GetStoredQuery x -> GetStoredQuery)
-> Generic GetStoredQuery
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' :: Text -> GetStoredQuery
GetStoredQuery' {$sel:queryName:GetStoredQuery' :: Text
queryName = Text
pQueryName_}
getStoredQuery_queryName :: Lens.Lens' GetStoredQuery Prelude.Text
getStoredQuery_queryName :: (Text -> f Text) -> GetStoredQuery -> f GetStoredQuery
getStoredQuery_queryName = (GetStoredQuery -> Text)
-> (GetStoredQuery -> Text -> GetStoredQuery)
-> Lens GetStoredQuery GetStoredQuery Text Text
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 :: GetStoredQuery -> Request GetStoredQuery
request = Service -> GetStoredQuery -> Request GetStoredQuery
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetStoredQuery
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStoredQuery)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetStoredQuery))
-> Logger
-> Service
-> Proxy GetStoredQuery
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStoredQuery)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe StoredQuery -> Int -> GetStoredQueryResponse
GetStoredQueryResponse'
(Maybe StoredQuery -> Int -> GetStoredQueryResponse)
-> Either String (Maybe StoredQuery)
-> Either String (Int -> GetStoredQueryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe StoredQuery)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StoredQuery")
Either String (Int -> GetStoredQueryResponse)
-> Either String Int -> Either String GetStoredQueryResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetStoredQuery
instance Prelude.NFData GetStoredQuery
instance Core.ToHeaders GetStoredQuery where
toHeaders :: GetStoredQuery -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetStoredQuery -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"StarlingDoveService.GetStoredQuery" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetStoredQuery where
toJSON :: GetStoredQuery -> Value
toJSON GetStoredQuery' {Text
queryName :: Text
$sel:queryName:GetStoredQuery' :: GetStoredQuery -> 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
"QueryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryName)]
)
instance Core.ToPath GetStoredQuery where
toPath :: GetStoredQuery -> ByteString
toPath = ByteString -> GetStoredQuery -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetStoredQuery where
toQuery :: GetStoredQuery -> QueryString
toQuery = QueryString -> GetStoredQuery -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetStoredQueryResponse -> GetStoredQueryResponse -> Bool)
-> (GetStoredQueryResponse -> GetStoredQueryResponse -> Bool)
-> Eq GetStoredQueryResponse
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]
(Int -> ReadS GetStoredQueryResponse)
-> ReadS [GetStoredQueryResponse]
-> ReadPrec GetStoredQueryResponse
-> ReadPrec [GetStoredQueryResponse]
-> Read 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
(Int -> GetStoredQueryResponse -> ShowS)
-> (GetStoredQueryResponse -> String)
-> ([GetStoredQueryResponse] -> ShowS)
-> Show GetStoredQueryResponse
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. GetStoredQueryResponse -> Rep GetStoredQueryResponse x)
-> (forall x.
Rep GetStoredQueryResponse x -> GetStoredQueryResponse)
-> Generic GetStoredQueryResponse
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' :: Maybe StoredQuery -> Int -> GetStoredQueryResponse
GetStoredQueryResponse'
{ $sel:storedQuery:GetStoredQueryResponse' :: Maybe StoredQuery
storedQuery =
Maybe StoredQuery
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStoredQueryResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStoredQueryResponse_storedQuery :: Lens.Lens' GetStoredQueryResponse (Prelude.Maybe StoredQuery)
getStoredQueryResponse_storedQuery :: (Maybe StoredQuery -> f (Maybe StoredQuery))
-> GetStoredQueryResponse -> f GetStoredQueryResponse
getStoredQueryResponse_storedQuery = (GetStoredQueryResponse -> Maybe StoredQuery)
-> (GetStoredQueryResponse
-> Maybe StoredQuery -> GetStoredQueryResponse)
-> Lens
GetStoredQueryResponse
GetStoredQueryResponse
(Maybe StoredQuery)
(Maybe 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 :: (Int -> f Int)
-> GetStoredQueryResponse -> f GetStoredQueryResponse
getStoredQueryResponse_httpStatus = (GetStoredQueryResponse -> Int)
-> (GetStoredQueryResponse -> Int -> GetStoredQueryResponse)
-> Lens GetStoredQueryResponse GetStoredQueryResponse Int Int
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