{-# 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.ListStacks
(
ListStacks (..),
newListStacks,
listStacks_nextToken,
listStacks_stackStatusFilter,
ListStacksResponse (..),
newListStacksResponse,
listStacksResponse_nextToken,
listStacksResponse_stackSummaries,
listStacksResponse_httpStatus,
)
where
import Amazonka.CloudFormation.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 ListStacks = ListStacks'
{
ListStacks -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListStacks -> Maybe [StackStatus]
stackStatusFilter :: Prelude.Maybe [StackStatus]
}
deriving (ListStacks -> ListStacks -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListStacks -> ListStacks -> Bool
$c/= :: ListStacks -> ListStacks -> Bool
== :: ListStacks -> ListStacks -> Bool
$c== :: ListStacks -> ListStacks -> Bool
Prelude.Eq, ReadPrec [ListStacks]
ReadPrec ListStacks
Int -> ReadS ListStacks
ReadS [ListStacks]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListStacks]
$creadListPrec :: ReadPrec [ListStacks]
readPrec :: ReadPrec ListStacks
$creadPrec :: ReadPrec ListStacks
readList :: ReadS [ListStacks]
$creadList :: ReadS [ListStacks]
readsPrec :: Int -> ReadS ListStacks
$creadsPrec :: Int -> ReadS ListStacks
Prelude.Read, Int -> ListStacks -> ShowS
[ListStacks] -> ShowS
ListStacks -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListStacks] -> ShowS
$cshowList :: [ListStacks] -> ShowS
show :: ListStacks -> String
$cshow :: ListStacks -> String
showsPrec :: Int -> ListStacks -> ShowS
$cshowsPrec :: Int -> ListStacks -> ShowS
Prelude.Show, forall x. Rep ListStacks x -> ListStacks
forall x. ListStacks -> Rep ListStacks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListStacks x -> ListStacks
$cfrom :: forall x. ListStacks -> Rep ListStacks x
Prelude.Generic)
newListStacks ::
ListStacks
newListStacks :: ListStacks
newListStacks =
ListStacks'
{ $sel:nextToken:ListStacks' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:stackStatusFilter:ListStacks' :: Maybe [StackStatus]
stackStatusFilter = forall a. Maybe a
Prelude.Nothing
}
listStacks_nextToken :: Lens.Lens' ListStacks (Prelude.Maybe Prelude.Text)
listStacks_nextToken :: Lens' ListStacks (Maybe Text)
listStacks_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStacks' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListStacks' :: ListStacks -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListStacks
s@ListStacks' {} Maybe Text
a -> ListStacks
s {$sel:nextToken:ListStacks' :: Maybe Text
nextToken = Maybe Text
a} :: ListStacks)
listStacks_stackStatusFilter :: Lens.Lens' ListStacks (Prelude.Maybe [StackStatus])
listStacks_stackStatusFilter :: Lens' ListStacks (Maybe [StackStatus])
listStacks_stackStatusFilter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStacks' {Maybe [StackStatus]
stackStatusFilter :: Maybe [StackStatus]
$sel:stackStatusFilter:ListStacks' :: ListStacks -> Maybe [StackStatus]
stackStatusFilter} -> Maybe [StackStatus]
stackStatusFilter) (\s :: ListStacks
s@ListStacks' {} Maybe [StackStatus]
a -> ListStacks
s {$sel:stackStatusFilter:ListStacks' :: Maybe [StackStatus]
stackStatusFilter = Maybe [StackStatus]
a} :: ListStacks) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSPager ListStacks where
page :: ListStacks -> AWSResponse ListStacks -> Maybe ListStacks
page ListStacks
rq AWSResponse ListStacks
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListStacks
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListStacksResponse (Maybe Text)
listStacksResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListStacks
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListStacksResponse (Maybe [StackSummary])
listStacksResponse_stackSummaries
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListStacks
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListStacks (Maybe Text)
listStacks_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListStacks
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListStacksResponse (Maybe Text)
listStacksResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListStacks where
type AWSResponse ListStacks = ListStacksResponse
request :: (Service -> Service) -> ListStacks -> Request ListStacks
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListStacks
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListStacks)))
response =
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
-> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
Text
"ListStacksResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Maybe [StackSummary] -> Int -> ListStacksResponse
ListStacksResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"NextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"StackSummaries"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
)
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 ListStacks where
hashWithSalt :: Int -> ListStacks -> Int
hashWithSalt Int
_salt ListStacks' {Maybe [StackStatus]
Maybe Text
stackStatusFilter :: Maybe [StackStatus]
nextToken :: Maybe Text
$sel:stackStatusFilter:ListStacks' :: ListStacks -> Maybe [StackStatus]
$sel:nextToken:ListStacks' :: ListStacks -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [StackStatus]
stackStatusFilter
instance Prelude.NFData ListStacks where
rnf :: ListStacks -> ()
rnf ListStacks' {Maybe [StackStatus]
Maybe Text
stackStatusFilter :: Maybe [StackStatus]
nextToken :: Maybe Text
$sel:stackStatusFilter:ListStacks' :: ListStacks -> Maybe [StackStatus]
$sel:nextToken:ListStacks' :: ListStacks -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [StackStatus]
stackStatusFilter
instance Data.ToHeaders ListStacks where
toHeaders :: ListStacks -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListStacks where
toPath :: ListStacks -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListStacks where
toQuery :: ListStacks -> QueryString
toQuery ListStacks' {Maybe [StackStatus]
Maybe Text
stackStatusFilter :: Maybe [StackStatus]
nextToken :: Maybe Text
$sel:stackStatusFilter:ListStacks' :: ListStacks -> Maybe [StackStatus]
$sel:nextToken:ListStacks' :: ListStacks -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListStacks" :: Prelude.ByteString),
ByteString
"Version"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
ByteString
"StackStatusFilter"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member"
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [StackStatus]
stackStatusFilter
)
]
data ListStacksResponse = ListStacksResponse'
{
ListStacksResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListStacksResponse -> Maybe [StackSummary]
stackSummaries :: Prelude.Maybe [StackSummary],
ListStacksResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListStacksResponse -> ListStacksResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListStacksResponse -> ListStacksResponse -> Bool
$c/= :: ListStacksResponse -> ListStacksResponse -> Bool
== :: ListStacksResponse -> ListStacksResponse -> Bool
$c== :: ListStacksResponse -> ListStacksResponse -> Bool
Prelude.Eq, ReadPrec [ListStacksResponse]
ReadPrec ListStacksResponse
Int -> ReadS ListStacksResponse
ReadS [ListStacksResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListStacksResponse]
$creadListPrec :: ReadPrec [ListStacksResponse]
readPrec :: ReadPrec ListStacksResponse
$creadPrec :: ReadPrec ListStacksResponse
readList :: ReadS [ListStacksResponse]
$creadList :: ReadS [ListStacksResponse]
readsPrec :: Int -> ReadS ListStacksResponse
$creadsPrec :: Int -> ReadS ListStacksResponse
Prelude.Read, Int -> ListStacksResponse -> ShowS
[ListStacksResponse] -> ShowS
ListStacksResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListStacksResponse] -> ShowS
$cshowList :: [ListStacksResponse] -> ShowS
show :: ListStacksResponse -> String
$cshow :: ListStacksResponse -> String
showsPrec :: Int -> ListStacksResponse -> ShowS
$cshowsPrec :: Int -> ListStacksResponse -> ShowS
Prelude.Show, forall x. Rep ListStacksResponse x -> ListStacksResponse
forall x. ListStacksResponse -> Rep ListStacksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListStacksResponse x -> ListStacksResponse
$cfrom :: forall x. ListStacksResponse -> Rep ListStacksResponse x
Prelude.Generic)
newListStacksResponse ::
Prelude.Int ->
ListStacksResponse
newListStacksResponse :: Int -> ListStacksResponse
newListStacksResponse Int
pHttpStatus_ =
ListStacksResponse'
{ $sel:nextToken:ListStacksResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:stackSummaries:ListStacksResponse' :: Maybe [StackSummary]
stackSummaries = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListStacksResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listStacksResponse_nextToken :: Lens.Lens' ListStacksResponse (Prelude.Maybe Prelude.Text)
listStacksResponse_nextToken :: Lens' ListStacksResponse (Maybe Text)
listStacksResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStacksResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListStacksResponse' :: ListStacksResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListStacksResponse
s@ListStacksResponse' {} Maybe Text
a -> ListStacksResponse
s {$sel:nextToken:ListStacksResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListStacksResponse)
listStacksResponse_stackSummaries :: Lens.Lens' ListStacksResponse (Prelude.Maybe [StackSummary])
listStacksResponse_stackSummaries :: Lens' ListStacksResponse (Maybe [StackSummary])
listStacksResponse_stackSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStacksResponse' {Maybe [StackSummary]
stackSummaries :: Maybe [StackSummary]
$sel:stackSummaries:ListStacksResponse' :: ListStacksResponse -> Maybe [StackSummary]
stackSummaries} -> Maybe [StackSummary]
stackSummaries) (\s :: ListStacksResponse
s@ListStacksResponse' {} Maybe [StackSummary]
a -> ListStacksResponse
s {$sel:stackSummaries:ListStacksResponse' :: Maybe [StackSummary]
stackSummaries = Maybe [StackSummary]
a} :: ListStacksResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listStacksResponse_httpStatus :: Lens.Lens' ListStacksResponse Prelude.Int
listStacksResponse_httpStatus :: Lens' ListStacksResponse Int
listStacksResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStacksResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListStacksResponse' :: ListStacksResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListStacksResponse
s@ListStacksResponse' {} Int
a -> ListStacksResponse
s {$sel:httpStatus:ListStacksResponse' :: Int
httpStatus = Int
a} :: ListStacksResponse)
instance Prelude.NFData ListStacksResponse where
rnf :: ListStacksResponse -> ()
rnf ListStacksResponse' {Int
Maybe [StackSummary]
Maybe Text
httpStatus :: Int
stackSummaries :: Maybe [StackSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListStacksResponse' :: ListStacksResponse -> Int
$sel:stackSummaries:ListStacksResponse' :: ListStacksResponse -> Maybe [StackSummary]
$sel:nextToken:ListStacksResponse' :: ListStacksResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [StackSummary]
stackSummaries
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus