{-# 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.ListImports
(
ListImports (..),
newListImports,
listImports_nextToken,
listImports_exportName,
ListImportsResponse (..),
newListImportsResponse,
listImportsResponse_imports,
listImportsResponse_nextToken,
listImportsResponse_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 ListImports = ListImports'
{
ListImports -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListImports -> Text
exportName :: Prelude.Text
}
deriving (ListImports -> ListImports -> Bool
(ListImports -> ListImports -> Bool)
-> (ListImports -> ListImports -> Bool) -> Eq ListImports
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListImports -> ListImports -> Bool
$c/= :: ListImports -> ListImports -> Bool
== :: ListImports -> ListImports -> Bool
$c== :: ListImports -> ListImports -> Bool
Prelude.Eq, ReadPrec [ListImports]
ReadPrec ListImports
Int -> ReadS ListImports
ReadS [ListImports]
(Int -> ReadS ListImports)
-> ReadS [ListImports]
-> ReadPrec ListImports
-> ReadPrec [ListImports]
-> Read ListImports
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListImports]
$creadListPrec :: ReadPrec [ListImports]
readPrec :: ReadPrec ListImports
$creadPrec :: ReadPrec ListImports
readList :: ReadS [ListImports]
$creadList :: ReadS [ListImports]
readsPrec :: Int -> ReadS ListImports
$creadsPrec :: Int -> ReadS ListImports
Prelude.Read, Int -> ListImports -> ShowS
[ListImports] -> ShowS
ListImports -> String
(Int -> ListImports -> ShowS)
-> (ListImports -> String)
-> ([ListImports] -> ShowS)
-> Show ListImports
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListImports] -> ShowS
$cshowList :: [ListImports] -> ShowS
show :: ListImports -> String
$cshow :: ListImports -> String
showsPrec :: Int -> ListImports -> ShowS
$cshowsPrec :: Int -> ListImports -> ShowS
Prelude.Show, (forall x. ListImports -> Rep ListImports x)
-> (forall x. Rep ListImports x -> ListImports)
-> Generic ListImports
forall x. Rep ListImports x -> ListImports
forall x. ListImports -> Rep ListImports x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListImports x -> ListImports
$cfrom :: forall x. ListImports -> Rep ListImports x
Prelude.Generic)
newListImports ::
Prelude.Text ->
ListImports
newListImports :: Text -> ListImports
newListImports Text
pExportName_ =
ListImports' :: Maybe Text -> Text -> ListImports
ListImports'
{ $sel:nextToken:ListImports' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:exportName:ListImports' :: Text
exportName = Text
pExportName_
}
listImports_nextToken :: Lens.Lens' ListImports (Prelude.Maybe Prelude.Text)
listImports_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListImports -> f ListImports
listImports_nextToken = (ListImports -> Maybe Text)
-> (ListImports -> Maybe Text -> ListImports)
-> Lens ListImports ListImports (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImports' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListImports' :: ListImports -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListImports
s@ListImports' {} Maybe Text
a -> ListImports
s {$sel:nextToken:ListImports' :: Maybe Text
nextToken = Maybe Text
a} :: ListImports)
listImports_exportName :: Lens.Lens' ListImports Prelude.Text
listImports_exportName :: (Text -> f Text) -> ListImports -> f ListImports
listImports_exportName = (ListImports -> Text)
-> (ListImports -> Text -> ListImports)
-> Lens ListImports ListImports Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImports' {Text
exportName :: Text
$sel:exportName:ListImports' :: ListImports -> Text
exportName} -> Text
exportName) (\s :: ListImports
s@ListImports' {} Text
a -> ListImports
s {$sel:exportName:ListImports' :: Text
exportName = Text
a} :: ListImports)
instance Core.AWSPager ListImports where
page :: ListImports -> AWSResponse ListImports -> Maybe ListImports
page ListImports
rq AWSResponse ListImports
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListImports
ListImportsResponse
rs
ListImportsResponse
-> Getting (First Text) ListImportsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListImportsResponse -> Const (First Text) ListImportsResponse
Lens' ListImportsResponse (Maybe Text)
listImportsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListImportsResponse -> Const (First Text) ListImportsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListImportsResponse 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 ListImports
forall a. Maybe a
Prelude.Nothing
| Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListImports
ListImportsResponse
rs
ListImportsResponse
-> Getting (First [Text]) ListImportsResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> ListImportsResponse -> Const (First [Text]) ListImportsResponse
Lens' ListImportsResponse (Maybe [Text])
listImportsResponse_imports ((Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> ListImportsResponse -> Const (First [Text]) ListImportsResponse)
-> (([Text] -> Const (First [Text]) [Text])
-> Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> Getting (First [Text]) ListImportsResponse [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 ListImports
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListImports -> Maybe ListImports
forall a. a -> Maybe a
Prelude.Just (ListImports -> Maybe ListImports)
-> ListImports -> Maybe ListImports
forall a b. (a -> b) -> a -> b
Prelude.$
ListImports
rq
ListImports -> (ListImports -> ListImports) -> ListImports
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListImports -> Identity ListImports
Lens ListImports ListImports (Maybe Text) (Maybe Text)
listImports_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListImports -> Identity ListImports)
-> Maybe Text -> ListImports -> ListImports
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListImports
ListImportsResponse
rs
ListImportsResponse
-> Getting (First Text) ListImportsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListImportsResponse -> Const (First Text) ListImportsResponse
Lens' ListImportsResponse (Maybe Text)
listImportsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListImportsResponse -> Const (First Text) ListImportsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListImportsResponse 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 ListImports where
type AWSResponse ListImports = ListImportsResponse
request :: ListImports -> Request ListImports
request = Service -> ListImports -> Request ListImports
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy ListImports
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListImports)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse ListImports))
-> Logger
-> Service
-> Proxy ListImports
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListImports)))
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
"ListImportsResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [Text] -> Maybe Text -> Int -> ListImportsResponse
ListImportsResponse'
(Maybe [Text] -> Maybe Text -> Int -> ListImportsResponse)
-> Either String (Maybe [Text])
-> Either String (Maybe Text -> Int -> ListImportsResponse)
forall (f :: * -> *) a b. Functor 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
"Imports" 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 [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Maybe Text -> Int -> ListImportsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListImportsResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> ListImportsResponse)
-> Either String Int -> Either String ListImportsResponse
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 ListImports
instance Prelude.NFData ListImports
instance Core.ToHeaders ListImports where
toHeaders :: ListImports -> ResponseHeaders
toHeaders = ResponseHeaders -> ListImports -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListImports where
toPath :: ListImports -> ByteString
toPath = ByteString -> ListImports -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListImports where
toQuery :: ListImports -> QueryString
toQuery ListImports' {Maybe Text
Text
exportName :: Text
nextToken :: Maybe Text
$sel:exportName:ListImports' :: ListImports -> Text
$sel:nextToken:ListImports' :: ListImports -> 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
"ListImports" :: 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,
ByteString
"ExportName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
exportName
]
data ListImportsResponse = ListImportsResponse'
{
ListImportsResponse -> Maybe [Text]
imports :: Prelude.Maybe [Prelude.Text],
ListImportsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListImportsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListImportsResponse -> ListImportsResponse -> Bool
(ListImportsResponse -> ListImportsResponse -> Bool)
-> (ListImportsResponse -> ListImportsResponse -> Bool)
-> Eq ListImportsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListImportsResponse -> ListImportsResponse -> Bool
$c/= :: ListImportsResponse -> ListImportsResponse -> Bool
== :: ListImportsResponse -> ListImportsResponse -> Bool
$c== :: ListImportsResponse -> ListImportsResponse -> Bool
Prelude.Eq, ReadPrec [ListImportsResponse]
ReadPrec ListImportsResponse
Int -> ReadS ListImportsResponse
ReadS [ListImportsResponse]
(Int -> ReadS ListImportsResponse)
-> ReadS [ListImportsResponse]
-> ReadPrec ListImportsResponse
-> ReadPrec [ListImportsResponse]
-> Read ListImportsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListImportsResponse]
$creadListPrec :: ReadPrec [ListImportsResponse]
readPrec :: ReadPrec ListImportsResponse
$creadPrec :: ReadPrec ListImportsResponse
readList :: ReadS [ListImportsResponse]
$creadList :: ReadS [ListImportsResponse]
readsPrec :: Int -> ReadS ListImportsResponse
$creadsPrec :: Int -> ReadS ListImportsResponse
Prelude.Read, Int -> ListImportsResponse -> ShowS
[ListImportsResponse] -> ShowS
ListImportsResponse -> String
(Int -> ListImportsResponse -> ShowS)
-> (ListImportsResponse -> String)
-> ([ListImportsResponse] -> ShowS)
-> Show ListImportsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListImportsResponse] -> ShowS
$cshowList :: [ListImportsResponse] -> ShowS
show :: ListImportsResponse -> String
$cshow :: ListImportsResponse -> String
showsPrec :: Int -> ListImportsResponse -> ShowS
$cshowsPrec :: Int -> ListImportsResponse -> ShowS
Prelude.Show, (forall x. ListImportsResponse -> Rep ListImportsResponse x)
-> (forall x. Rep ListImportsResponse x -> ListImportsResponse)
-> Generic ListImportsResponse
forall x. Rep ListImportsResponse x -> ListImportsResponse
forall x. ListImportsResponse -> Rep ListImportsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListImportsResponse x -> ListImportsResponse
$cfrom :: forall x. ListImportsResponse -> Rep ListImportsResponse x
Prelude.Generic)
newListImportsResponse ::
Prelude.Int ->
ListImportsResponse
newListImportsResponse :: Int -> ListImportsResponse
newListImportsResponse Int
pHttpStatus_ =
ListImportsResponse' :: Maybe [Text] -> Maybe Text -> Int -> ListImportsResponse
ListImportsResponse'
{ $sel:imports:ListImportsResponse' :: Maybe [Text]
imports = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListImportsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListImportsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listImportsResponse_imports :: Lens.Lens' ListImportsResponse (Prelude.Maybe [Prelude.Text])
listImportsResponse_imports :: (Maybe [Text] -> f (Maybe [Text]))
-> ListImportsResponse -> f ListImportsResponse
listImportsResponse_imports = (ListImportsResponse -> Maybe [Text])
-> (ListImportsResponse -> Maybe [Text] -> ListImportsResponse)
-> Lens' ListImportsResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImportsResponse' {Maybe [Text]
imports :: Maybe [Text]
$sel:imports:ListImportsResponse' :: ListImportsResponse -> Maybe [Text]
imports} -> Maybe [Text]
imports) (\s :: ListImportsResponse
s@ListImportsResponse' {} Maybe [Text]
a -> ListImportsResponse
s {$sel:imports:ListImportsResponse' :: Maybe [Text]
imports = Maybe [Text]
a} :: ListImportsResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> ListImportsResponse -> f ListImportsResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListImportsResponse
-> f ListImportsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listImportsResponse_nextToken :: Lens.Lens' ListImportsResponse (Prelude.Maybe Prelude.Text)
listImportsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListImportsResponse -> f ListImportsResponse
listImportsResponse_nextToken = (ListImportsResponse -> Maybe Text)
-> (ListImportsResponse -> Maybe Text -> ListImportsResponse)
-> Lens' ListImportsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImportsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListImportsResponse' :: ListImportsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListImportsResponse
s@ListImportsResponse' {} Maybe Text
a -> ListImportsResponse
s {$sel:nextToken:ListImportsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListImportsResponse)
listImportsResponse_httpStatus :: Lens.Lens' ListImportsResponse Prelude.Int
listImportsResponse_httpStatus :: (Int -> f Int) -> ListImportsResponse -> f ListImportsResponse
listImportsResponse_httpStatus = (ListImportsResponse -> Int)
-> (ListImportsResponse -> Int -> ListImportsResponse)
-> Lens ListImportsResponse ListImportsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListImportsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListImportsResponse' :: ListImportsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListImportsResponse
s@ListImportsResponse' {} Int
a -> ListImportsResponse
s {$sel:httpStatus:ListImportsResponse' :: Int
httpStatus = Int
a} :: ListImportsResponse)
instance Prelude.NFData ListImportsResponse