{-# 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.ListStoredQueries
(
ListStoredQueries (..),
newListStoredQueries,
listStoredQueries_nextToken,
listStoredQueries_maxResults,
ListStoredQueriesResponse (..),
newListStoredQueriesResponse,
listStoredQueriesResponse_storedQueryMetadata,
listStoredQueriesResponse_nextToken,
listStoredQueriesResponse_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 ListStoredQueries = ListStoredQueries'
{
ListStoredQueries -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListStoredQueries -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListStoredQueries -> ListStoredQueries -> Bool
(ListStoredQueries -> ListStoredQueries -> Bool)
-> (ListStoredQueries -> ListStoredQueries -> Bool)
-> Eq ListStoredQueries
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListStoredQueries -> ListStoredQueries -> Bool
$c/= :: ListStoredQueries -> ListStoredQueries -> Bool
== :: ListStoredQueries -> ListStoredQueries -> Bool
$c== :: ListStoredQueries -> ListStoredQueries -> Bool
Prelude.Eq, ReadPrec [ListStoredQueries]
ReadPrec ListStoredQueries
Int -> ReadS ListStoredQueries
ReadS [ListStoredQueries]
(Int -> ReadS ListStoredQueries)
-> ReadS [ListStoredQueries]
-> ReadPrec ListStoredQueries
-> ReadPrec [ListStoredQueries]
-> Read ListStoredQueries
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListStoredQueries]
$creadListPrec :: ReadPrec [ListStoredQueries]
readPrec :: ReadPrec ListStoredQueries
$creadPrec :: ReadPrec ListStoredQueries
readList :: ReadS [ListStoredQueries]
$creadList :: ReadS [ListStoredQueries]
readsPrec :: Int -> ReadS ListStoredQueries
$creadsPrec :: Int -> ReadS ListStoredQueries
Prelude.Read, Int -> ListStoredQueries -> ShowS
[ListStoredQueries] -> ShowS
ListStoredQueries -> String
(Int -> ListStoredQueries -> ShowS)
-> (ListStoredQueries -> String)
-> ([ListStoredQueries] -> ShowS)
-> Show ListStoredQueries
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListStoredQueries] -> ShowS
$cshowList :: [ListStoredQueries] -> ShowS
show :: ListStoredQueries -> String
$cshow :: ListStoredQueries -> String
showsPrec :: Int -> ListStoredQueries -> ShowS
$cshowsPrec :: Int -> ListStoredQueries -> ShowS
Prelude.Show, (forall x. ListStoredQueries -> Rep ListStoredQueries x)
-> (forall x. Rep ListStoredQueries x -> ListStoredQueries)
-> Generic ListStoredQueries
forall x. Rep ListStoredQueries x -> ListStoredQueries
forall x. ListStoredQueries -> Rep ListStoredQueries x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListStoredQueries x -> ListStoredQueries
$cfrom :: forall x. ListStoredQueries -> Rep ListStoredQueries x
Prelude.Generic)
newListStoredQueries ::
ListStoredQueries
newListStoredQueries :: ListStoredQueries
newListStoredQueries =
ListStoredQueries' :: Maybe Text -> Maybe Natural -> ListStoredQueries
ListStoredQueries'
{ $sel:nextToken:ListStoredQueries' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListStoredQueries' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listStoredQueries_nextToken :: Lens.Lens' ListStoredQueries (Prelude.Maybe Prelude.Text)
listStoredQueries_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListStoredQueries -> f ListStoredQueries
listStoredQueries_nextToken = (ListStoredQueries -> Maybe Text)
-> (ListStoredQueries -> Maybe Text -> ListStoredQueries)
-> Lens
ListStoredQueries ListStoredQueries (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStoredQueries' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListStoredQueries' :: ListStoredQueries -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListStoredQueries
s@ListStoredQueries' {} Maybe Text
a -> ListStoredQueries
s {$sel:nextToken:ListStoredQueries' :: Maybe Text
nextToken = Maybe Text
a} :: ListStoredQueries)
listStoredQueries_maxResults :: Lens.Lens' ListStoredQueries (Prelude.Maybe Prelude.Natural)
listStoredQueries_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListStoredQueries -> f ListStoredQueries
listStoredQueries_maxResults = (ListStoredQueries -> Maybe Natural)
-> (ListStoredQueries -> Maybe Natural -> ListStoredQueries)
-> Lens
ListStoredQueries ListStoredQueries (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStoredQueries' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListStoredQueries' :: ListStoredQueries -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListStoredQueries
s@ListStoredQueries' {} Maybe Natural
a -> ListStoredQueries
s {$sel:maxResults:ListStoredQueries' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListStoredQueries)
instance Core.AWSRequest ListStoredQueries where
type
AWSResponse ListStoredQueries =
ListStoredQueriesResponse
request :: ListStoredQueries -> Request ListStoredQueries
request = Service -> ListStoredQueries -> Request ListStoredQueries
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListStoredQueries
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListStoredQueries)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListStoredQueries))
-> Logger
-> Service
-> Proxy ListStoredQueries
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListStoredQueries)))
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 [StoredQueryMetadata]
-> Maybe Text -> Int -> ListStoredQueriesResponse
ListStoredQueriesResponse'
(Maybe [StoredQueryMetadata]
-> Maybe Text -> Int -> ListStoredQueriesResponse)
-> Either String (Maybe [StoredQueryMetadata])
-> Either String (Maybe Text -> Int -> ListStoredQueriesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [StoredQueryMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StoredQueryMetadata"
Either String (Maybe (Maybe [StoredQueryMetadata]))
-> Maybe [StoredQueryMetadata]
-> Either String (Maybe [StoredQueryMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [StoredQueryMetadata]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Maybe Text -> Int -> ListStoredQueriesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListStoredQueriesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Int -> ListStoredQueriesResponse)
-> Either String Int -> Either String ListStoredQueriesResponse
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 ListStoredQueries
instance Prelude.NFData ListStoredQueries
instance Core.ToHeaders ListStoredQueries where
toHeaders :: ListStoredQueries -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListStoredQueries -> 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.ListStoredQueries" ::
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 ListStoredQueries where
toJSON :: ListStoredQueries -> Value
toJSON ListStoredQueries' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListStoredQueries' :: ListStoredQueries -> Maybe Natural
$sel:nextToken:ListStoredQueries' :: ListStoredQueries -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" 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
nextToken,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
]
)
instance Core.ToPath ListStoredQueries where
toPath :: ListStoredQueries -> ByteString
toPath = ByteString -> ListStoredQueries -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListStoredQueries where
toQuery :: ListStoredQueries -> QueryString
toQuery = QueryString -> ListStoredQueries -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListStoredQueriesResponse = ListStoredQueriesResponse'
{
ListStoredQueriesResponse -> Maybe [StoredQueryMetadata]
storedQueryMetadata :: Prelude.Maybe [StoredQueryMetadata],
ListStoredQueriesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListStoredQueriesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListStoredQueriesResponse -> ListStoredQueriesResponse -> Bool
(ListStoredQueriesResponse -> ListStoredQueriesResponse -> Bool)
-> (ListStoredQueriesResponse -> ListStoredQueriesResponse -> Bool)
-> Eq ListStoredQueriesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListStoredQueriesResponse -> ListStoredQueriesResponse -> Bool
$c/= :: ListStoredQueriesResponse -> ListStoredQueriesResponse -> Bool
== :: ListStoredQueriesResponse -> ListStoredQueriesResponse -> Bool
$c== :: ListStoredQueriesResponse -> ListStoredQueriesResponse -> Bool
Prelude.Eq, ReadPrec [ListStoredQueriesResponse]
ReadPrec ListStoredQueriesResponse
Int -> ReadS ListStoredQueriesResponse
ReadS [ListStoredQueriesResponse]
(Int -> ReadS ListStoredQueriesResponse)
-> ReadS [ListStoredQueriesResponse]
-> ReadPrec ListStoredQueriesResponse
-> ReadPrec [ListStoredQueriesResponse]
-> Read ListStoredQueriesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListStoredQueriesResponse]
$creadListPrec :: ReadPrec [ListStoredQueriesResponse]
readPrec :: ReadPrec ListStoredQueriesResponse
$creadPrec :: ReadPrec ListStoredQueriesResponse
readList :: ReadS [ListStoredQueriesResponse]
$creadList :: ReadS [ListStoredQueriesResponse]
readsPrec :: Int -> ReadS ListStoredQueriesResponse
$creadsPrec :: Int -> ReadS ListStoredQueriesResponse
Prelude.Read, Int -> ListStoredQueriesResponse -> ShowS
[ListStoredQueriesResponse] -> ShowS
ListStoredQueriesResponse -> String
(Int -> ListStoredQueriesResponse -> ShowS)
-> (ListStoredQueriesResponse -> String)
-> ([ListStoredQueriesResponse] -> ShowS)
-> Show ListStoredQueriesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListStoredQueriesResponse] -> ShowS
$cshowList :: [ListStoredQueriesResponse] -> ShowS
show :: ListStoredQueriesResponse -> String
$cshow :: ListStoredQueriesResponse -> String
showsPrec :: Int -> ListStoredQueriesResponse -> ShowS
$cshowsPrec :: Int -> ListStoredQueriesResponse -> ShowS
Prelude.Show, (forall x.
ListStoredQueriesResponse -> Rep ListStoredQueriesResponse x)
-> (forall x.
Rep ListStoredQueriesResponse x -> ListStoredQueriesResponse)
-> Generic ListStoredQueriesResponse
forall x.
Rep ListStoredQueriesResponse x -> ListStoredQueriesResponse
forall x.
ListStoredQueriesResponse -> Rep ListStoredQueriesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListStoredQueriesResponse x -> ListStoredQueriesResponse
$cfrom :: forall x.
ListStoredQueriesResponse -> Rep ListStoredQueriesResponse x
Prelude.Generic)
newListStoredQueriesResponse ::
Prelude.Int ->
ListStoredQueriesResponse
newListStoredQueriesResponse :: Int -> ListStoredQueriesResponse
newListStoredQueriesResponse Int
pHttpStatus_ =
ListStoredQueriesResponse' :: Maybe [StoredQueryMetadata]
-> Maybe Text -> Int -> ListStoredQueriesResponse
ListStoredQueriesResponse'
{ $sel:storedQueryMetadata:ListStoredQueriesResponse' :: Maybe [StoredQueryMetadata]
storedQueryMetadata =
Maybe [StoredQueryMetadata]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListStoredQueriesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListStoredQueriesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listStoredQueriesResponse_storedQueryMetadata :: Lens.Lens' ListStoredQueriesResponse (Prelude.Maybe [StoredQueryMetadata])
listStoredQueriesResponse_storedQueryMetadata :: (Maybe [StoredQueryMetadata] -> f (Maybe [StoredQueryMetadata]))
-> ListStoredQueriesResponse -> f ListStoredQueriesResponse
listStoredQueriesResponse_storedQueryMetadata = (ListStoredQueriesResponse -> Maybe [StoredQueryMetadata])
-> (ListStoredQueriesResponse
-> Maybe [StoredQueryMetadata] -> ListStoredQueriesResponse)
-> Lens
ListStoredQueriesResponse
ListStoredQueriesResponse
(Maybe [StoredQueryMetadata])
(Maybe [StoredQueryMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStoredQueriesResponse' {Maybe [StoredQueryMetadata]
storedQueryMetadata :: Maybe [StoredQueryMetadata]
$sel:storedQueryMetadata:ListStoredQueriesResponse' :: ListStoredQueriesResponse -> Maybe [StoredQueryMetadata]
storedQueryMetadata} -> Maybe [StoredQueryMetadata]
storedQueryMetadata) (\s :: ListStoredQueriesResponse
s@ListStoredQueriesResponse' {} Maybe [StoredQueryMetadata]
a -> ListStoredQueriesResponse
s {$sel:storedQueryMetadata:ListStoredQueriesResponse' :: Maybe [StoredQueryMetadata]
storedQueryMetadata = Maybe [StoredQueryMetadata]
a} :: ListStoredQueriesResponse) ((Maybe [StoredQueryMetadata] -> f (Maybe [StoredQueryMetadata]))
-> ListStoredQueriesResponse -> f ListStoredQueriesResponse)
-> ((Maybe [StoredQueryMetadata]
-> f (Maybe [StoredQueryMetadata]))
-> Maybe [StoredQueryMetadata] -> f (Maybe [StoredQueryMetadata]))
-> (Maybe [StoredQueryMetadata] -> f (Maybe [StoredQueryMetadata]))
-> ListStoredQueriesResponse
-> f ListStoredQueriesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[StoredQueryMetadata]
[StoredQueryMetadata]
[StoredQueryMetadata]
[StoredQueryMetadata]
-> Iso
(Maybe [StoredQueryMetadata])
(Maybe [StoredQueryMetadata])
(Maybe [StoredQueryMetadata])
(Maybe [StoredQueryMetadata])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[StoredQueryMetadata]
[StoredQueryMetadata]
[StoredQueryMetadata]
[StoredQueryMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listStoredQueriesResponse_nextToken :: Lens.Lens' ListStoredQueriesResponse (Prelude.Maybe Prelude.Text)
listStoredQueriesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListStoredQueriesResponse -> f ListStoredQueriesResponse
listStoredQueriesResponse_nextToken = (ListStoredQueriesResponse -> Maybe Text)
-> (ListStoredQueriesResponse
-> Maybe Text -> ListStoredQueriesResponse)
-> Lens
ListStoredQueriesResponse
ListStoredQueriesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStoredQueriesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListStoredQueriesResponse' :: ListStoredQueriesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListStoredQueriesResponse
s@ListStoredQueriesResponse' {} Maybe Text
a -> ListStoredQueriesResponse
s {$sel:nextToken:ListStoredQueriesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListStoredQueriesResponse)
listStoredQueriesResponse_httpStatus :: Lens.Lens' ListStoredQueriesResponse Prelude.Int
listStoredQueriesResponse_httpStatus :: (Int -> f Int)
-> ListStoredQueriesResponse -> f ListStoredQueriesResponse
listStoredQueriesResponse_httpStatus = (ListStoredQueriesResponse -> Int)
-> (ListStoredQueriesResponse -> Int -> ListStoredQueriesResponse)
-> Lens ListStoredQueriesResponse ListStoredQueriesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStoredQueriesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListStoredQueriesResponse' :: ListStoredQueriesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListStoredQueriesResponse
s@ListStoredQueriesResponse' {} Int
a -> ListStoredQueriesResponse
s {$sel:httpStatus:ListStoredQueriesResponse' :: Int
httpStatus = Int
a} :: ListStoredQueriesResponse)
instance Prelude.NFData ListStoredQueriesResponse