{-# 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.CloudFormation.ListExports
(
ListExports (..),
newListExports,
listExports_nextToken,
ListExportsResponse (..),
newListExportsResponse,
listExportsResponse_nextToken,
listExportsResponse_exports,
listExportsResponse_httpStatus,
)
where
import Amazonka.CloudFormation.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 ListExports = ListExports'
{
ListExports -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListExports -> ListExports -> Bool
(ListExports -> ListExports -> Bool)
-> (ListExports -> ListExports -> Bool) -> Eq ListExports
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListExports -> ListExports -> Bool
$c/= :: ListExports -> ListExports -> Bool
== :: ListExports -> ListExports -> Bool
$c== :: ListExports -> ListExports -> Bool
Prelude.Eq, ReadPrec [ListExports]
ReadPrec ListExports
Int -> ReadS ListExports
ReadS [ListExports]
(Int -> ReadS ListExports)
-> ReadS [ListExports]
-> ReadPrec ListExports
-> ReadPrec [ListExports]
-> Read ListExports
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListExports]
$creadListPrec :: ReadPrec [ListExports]
readPrec :: ReadPrec ListExports
$creadPrec :: ReadPrec ListExports
readList :: ReadS [ListExports]
$creadList :: ReadS [ListExports]
readsPrec :: Int -> ReadS ListExports
$creadsPrec :: Int -> ReadS ListExports
Prelude.Read, Int -> ListExports -> ShowS
[ListExports] -> ShowS
ListExports -> String
(Int -> ListExports -> ShowS)
-> (ListExports -> String)
-> ([ListExports] -> ShowS)
-> Show ListExports
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListExports] -> ShowS
$cshowList :: [ListExports] -> ShowS
show :: ListExports -> String
$cshow :: ListExports -> String
showsPrec :: Int -> ListExports -> ShowS
$cshowsPrec :: Int -> ListExports -> ShowS
Prelude.Show, (forall x. ListExports -> Rep ListExports x)
-> (forall x. Rep ListExports x -> ListExports)
-> Generic ListExports
forall x. Rep ListExports x -> ListExports
forall x. ListExports -> Rep ListExports x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListExports x -> ListExports
$cfrom :: forall x. ListExports -> Rep ListExports x
Prelude.Generic)
newListExports ::
ListExports
newListExports :: ListExports
newListExports =
ListExports' :: Maybe Text -> ListExports
ListExports' {$sel:nextToken:ListExports' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing}
listExports_nextToken :: Lens.Lens' ListExports (Prelude.Maybe Prelude.Text)
listExports_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListExports -> f ListExports
listExports_nextToken = (ListExports -> Maybe Text)
-> (ListExports -> Maybe Text -> ListExports)
-> Lens ListExports ListExports (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExports' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListExports' :: ListExports -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListExports
s@ListExports' {} Maybe Text
a -> ListExports
s {$sel:nextToken:ListExports' :: Maybe Text
nextToken = Maybe Text
a} :: ListExports)
instance Core.AWSPager ListExports where
page :: ListExports -> AWSResponse ListExports -> Maybe ListExports
page ListExports
rq AWSResponse ListExports
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListExports
ListExportsResponse
rs
ListExportsResponse
-> Getting (First Text) ListExportsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListExportsResponse -> Const (First Text) ListExportsResponse
Lens' ListExportsResponse (Maybe Text)
listExportsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListExportsResponse -> Const (First Text) ListExportsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListExportsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListExports
forall a. Maybe a
Prelude.Nothing
| Maybe [Export] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListExports
ListExportsResponse
rs
ListExportsResponse
-> Getting (First [Export]) ListExportsResponse [Export]
-> Maybe [Export]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Export] -> Const (First [Export]) (Maybe [Export]))
-> ListExportsResponse
-> Const (First [Export]) ListExportsResponse
Lens' ListExportsResponse (Maybe [Export])
listExportsResponse_exports ((Maybe [Export] -> Const (First [Export]) (Maybe [Export]))
-> ListExportsResponse
-> Const (First [Export]) ListExportsResponse)
-> (([Export] -> Const (First [Export]) [Export])
-> Maybe [Export] -> Const (First [Export]) (Maybe [Export]))
-> Getting (First [Export]) ListExportsResponse [Export]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Export] -> Const (First [Export]) [Export])
-> Maybe [Export] -> Const (First [Export]) (Maybe [Export])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListExports
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListExports -> Maybe ListExports
forall a. a -> Maybe a
Prelude.Just (ListExports -> Maybe ListExports)
-> ListExports -> Maybe ListExports
forall a b. (a -> b) -> a -> b
Prelude.$
ListExports
rq
ListExports -> (ListExports -> ListExports) -> ListExports
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListExports -> Identity ListExports
Lens ListExports ListExports (Maybe Text) (Maybe Text)
listExports_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListExports -> Identity ListExports)
-> Maybe Text -> ListExports -> ListExports
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListExports
ListExportsResponse
rs
ListExportsResponse
-> Getting (First Text) ListExportsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListExportsResponse -> Const (First Text) ListExportsResponse
Lens' ListExportsResponse (Maybe Text)
listExportsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListExportsResponse -> Const (First Text) ListExportsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListExportsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListExports where
type AWSResponse ListExports = ListExportsResponse
request :: ListExports -> Request ListExports
request = Service -> ListExports -> Request ListExports
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy ListExports
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListExports)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse ListExports))
-> Logger
-> Service
-> Proxy ListExports
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListExports)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"ListExportsResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Maybe [Export] -> Int -> ListExportsResponse
ListExportsResponse'
(Maybe Text -> Maybe [Export] -> Int -> ListExportsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Export] -> Int -> ListExportsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"NextToken")
Either String (Maybe [Export] -> Int -> ListExportsResponse)
-> Either String (Maybe [Export])
-> Either String (Int -> ListExportsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Exports" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Export]))
-> Either String (Maybe [Export])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Export])
-> [Node] -> Either String (Maybe [Export])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Export]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> ListExportsResponse)
-> Either String Int -> Either String ListExportsResponse
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 ListExports
instance Prelude.NFData ListExports
instance Core.ToHeaders ListExports where
toHeaders :: ListExports -> ResponseHeaders
toHeaders = ResponseHeaders -> ListExports -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListExports where
toPath :: ListExports -> ByteString
toPath = ByteString -> ListExports -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListExports where
toQuery :: ListExports -> QueryString
toQuery ListExports' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListExports' :: ListExports -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ListExports" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken
]
data ListExportsResponse = ListExportsResponse'
{
ListExportsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListExportsResponse -> Maybe [Export]
exports :: Prelude.Maybe [Export],
ListExportsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListExportsResponse -> ListExportsResponse -> Bool
(ListExportsResponse -> ListExportsResponse -> Bool)
-> (ListExportsResponse -> ListExportsResponse -> Bool)
-> Eq ListExportsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListExportsResponse -> ListExportsResponse -> Bool
$c/= :: ListExportsResponse -> ListExportsResponse -> Bool
== :: ListExportsResponse -> ListExportsResponse -> Bool
$c== :: ListExportsResponse -> ListExportsResponse -> Bool
Prelude.Eq, ReadPrec [ListExportsResponse]
ReadPrec ListExportsResponse
Int -> ReadS ListExportsResponse
ReadS [ListExportsResponse]
(Int -> ReadS ListExportsResponse)
-> ReadS [ListExportsResponse]
-> ReadPrec ListExportsResponse
-> ReadPrec [ListExportsResponse]
-> Read ListExportsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListExportsResponse]
$creadListPrec :: ReadPrec [ListExportsResponse]
readPrec :: ReadPrec ListExportsResponse
$creadPrec :: ReadPrec ListExportsResponse
readList :: ReadS [ListExportsResponse]
$creadList :: ReadS [ListExportsResponse]
readsPrec :: Int -> ReadS ListExportsResponse
$creadsPrec :: Int -> ReadS ListExportsResponse
Prelude.Read, Int -> ListExportsResponse -> ShowS
[ListExportsResponse] -> ShowS
ListExportsResponse -> String
(Int -> ListExportsResponse -> ShowS)
-> (ListExportsResponse -> String)
-> ([ListExportsResponse] -> ShowS)
-> Show ListExportsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListExportsResponse] -> ShowS
$cshowList :: [ListExportsResponse] -> ShowS
show :: ListExportsResponse -> String
$cshow :: ListExportsResponse -> String
showsPrec :: Int -> ListExportsResponse -> ShowS
$cshowsPrec :: Int -> ListExportsResponse -> ShowS
Prelude.Show, (forall x. ListExportsResponse -> Rep ListExportsResponse x)
-> (forall x. Rep ListExportsResponse x -> ListExportsResponse)
-> Generic ListExportsResponse
forall x. Rep ListExportsResponse x -> ListExportsResponse
forall x. ListExportsResponse -> Rep ListExportsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListExportsResponse x -> ListExportsResponse
$cfrom :: forall x. ListExportsResponse -> Rep ListExportsResponse x
Prelude.Generic)
newListExportsResponse ::
Prelude.Int ->
ListExportsResponse
newListExportsResponse :: Int -> ListExportsResponse
newListExportsResponse Int
pHttpStatus_ =
ListExportsResponse' :: Maybe Text -> Maybe [Export] -> Int -> ListExportsResponse
ListExportsResponse'
{ $sel:nextToken:ListExportsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:exports:ListExportsResponse' :: Maybe [Export]
exports = Maybe [Export]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListExportsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listExportsResponse_nextToken :: Lens.Lens' ListExportsResponse (Prelude.Maybe Prelude.Text)
listExportsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListExportsResponse -> f ListExportsResponse
listExportsResponse_nextToken = (ListExportsResponse -> Maybe Text)
-> (ListExportsResponse -> Maybe Text -> ListExportsResponse)
-> Lens' ListExportsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExportsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListExportsResponse' :: ListExportsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListExportsResponse
s@ListExportsResponse' {} Maybe Text
a -> ListExportsResponse
s {$sel:nextToken:ListExportsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListExportsResponse)
listExportsResponse_exports :: Lens.Lens' ListExportsResponse (Prelude.Maybe [Export])
listExportsResponse_exports :: (Maybe [Export] -> f (Maybe [Export]))
-> ListExportsResponse -> f ListExportsResponse
listExportsResponse_exports = (ListExportsResponse -> Maybe [Export])
-> (ListExportsResponse -> Maybe [Export] -> ListExportsResponse)
-> Lens' ListExportsResponse (Maybe [Export])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExportsResponse' {Maybe [Export]
exports :: Maybe [Export]
$sel:exports:ListExportsResponse' :: ListExportsResponse -> Maybe [Export]
exports} -> Maybe [Export]
exports) (\s :: ListExportsResponse
s@ListExportsResponse' {} Maybe [Export]
a -> ListExportsResponse
s {$sel:exports:ListExportsResponse' :: Maybe [Export]
exports = Maybe [Export]
a} :: ListExportsResponse) ((Maybe [Export] -> f (Maybe [Export]))
-> ListExportsResponse -> f ListExportsResponse)
-> ((Maybe [Export] -> f (Maybe [Export]))
-> Maybe [Export] -> f (Maybe [Export]))
-> (Maybe [Export] -> f (Maybe [Export]))
-> ListExportsResponse
-> f ListExportsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Export] [Export] [Export] [Export]
-> Iso
(Maybe [Export]) (Maybe [Export]) (Maybe [Export]) (Maybe [Export])
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 [Export] [Export] [Export] [Export]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listExportsResponse_httpStatus :: Lens.Lens' ListExportsResponse Prelude.Int
listExportsResponse_httpStatus :: (Int -> f Int) -> ListExportsResponse -> f ListExportsResponse
listExportsResponse_httpStatus = (ListExportsResponse -> Int)
-> (ListExportsResponse -> Int -> ListExportsResponse)
-> Lens ListExportsResponse ListExportsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListExportsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListExportsResponse' :: ListExportsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListExportsResponse
s@ListExportsResponse' {} Int
a -> ListExportsResponse
s {$sel:httpStatus:ListExportsResponse' :: Int
httpStatus = Int
a} :: ListExportsResponse)
instance Prelude.NFData ListExportsResponse