{-# 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.ListStackResources
(
ListStackResources (..),
newListStackResources,
listStackResources_nextToken,
listStackResources_stackName,
ListStackResourcesResponse (..),
newListStackResourcesResponse,
listStackResourcesResponse_nextToken,
listStackResourcesResponse_stackResourceSummaries,
listStackResourcesResponse_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 ListStackResources = ListStackResources'
{
ListStackResources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListStackResources -> Text
stackName :: Prelude.Text
}
deriving (ListStackResources -> ListStackResources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListStackResources -> ListStackResources -> Bool
$c/= :: ListStackResources -> ListStackResources -> Bool
== :: ListStackResources -> ListStackResources -> Bool
$c== :: ListStackResources -> ListStackResources -> Bool
Prelude.Eq, ReadPrec [ListStackResources]
ReadPrec ListStackResources
Int -> ReadS ListStackResources
ReadS [ListStackResources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListStackResources]
$creadListPrec :: ReadPrec [ListStackResources]
readPrec :: ReadPrec ListStackResources
$creadPrec :: ReadPrec ListStackResources
readList :: ReadS [ListStackResources]
$creadList :: ReadS [ListStackResources]
readsPrec :: Int -> ReadS ListStackResources
$creadsPrec :: Int -> ReadS ListStackResources
Prelude.Read, Int -> ListStackResources -> ShowS
[ListStackResources] -> ShowS
ListStackResources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListStackResources] -> ShowS
$cshowList :: [ListStackResources] -> ShowS
show :: ListStackResources -> String
$cshow :: ListStackResources -> String
showsPrec :: Int -> ListStackResources -> ShowS
$cshowsPrec :: Int -> ListStackResources -> ShowS
Prelude.Show, forall x. Rep ListStackResources x -> ListStackResources
forall x. ListStackResources -> Rep ListStackResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListStackResources x -> ListStackResources
$cfrom :: forall x. ListStackResources -> Rep ListStackResources x
Prelude.Generic)
newListStackResources ::
Prelude.Text ->
ListStackResources
newListStackResources :: Text -> ListStackResources
newListStackResources Text
pStackName_ =
ListStackResources'
{ $sel:nextToken:ListStackResources' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:stackName:ListStackResources' :: Text
stackName = Text
pStackName_
}
listStackResources_nextToken :: Lens.Lens' ListStackResources (Prelude.Maybe Prelude.Text)
listStackResources_nextToken :: Lens' ListStackResources (Maybe Text)
listStackResources_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackResources' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListStackResources' :: ListStackResources -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListStackResources
s@ListStackResources' {} Maybe Text
a -> ListStackResources
s {$sel:nextToken:ListStackResources' :: Maybe Text
nextToken = Maybe Text
a} :: ListStackResources)
listStackResources_stackName :: Lens.Lens' ListStackResources Prelude.Text
listStackResources_stackName :: Lens' ListStackResources Text
listStackResources_stackName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackResources' {Text
stackName :: Text
$sel:stackName:ListStackResources' :: ListStackResources -> Text
stackName} -> Text
stackName) (\s :: ListStackResources
s@ListStackResources' {} Text
a -> ListStackResources
s {$sel:stackName:ListStackResources' :: Text
stackName = Text
a} :: ListStackResources)
instance Core.AWSPager ListStackResources where
page :: ListStackResources
-> AWSResponse ListStackResources -> Maybe ListStackResources
page ListStackResources
rq AWSResponse ListStackResources
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListStackResources
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListStackResourcesResponse (Maybe Text)
listStackResourcesResponse_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 ListStackResources
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListStackResourcesResponse (Maybe [StackResourceSummary])
listStackResourcesResponse_stackResourceSummaries
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.$ ListStackResources
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListStackResources (Maybe Text)
listStackResources_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListStackResources
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListStackResourcesResponse (Maybe Text)
listStackResourcesResponse_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 ListStackResources where
type
AWSResponse ListStackResources =
ListStackResourcesResponse
request :: (Service -> Service)
-> ListStackResources -> Request ListStackResources
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 ListStackResources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListStackResources)))
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
"ListStackResourcesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text
-> Maybe [StackResourceSummary]
-> Int
-> ListStackResourcesResponse
ListStackResourcesResponse'
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
"StackResourceSummaries"
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 ListStackResources where
hashWithSalt :: Int -> ListStackResources -> Int
hashWithSalt Int
_salt ListStackResources' {Maybe Text
Text
stackName :: Text
nextToken :: Maybe Text
$sel:stackName:ListStackResources' :: ListStackResources -> Text
$sel:nextToken:ListStackResources' :: ListStackResources -> 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` Text
stackName
instance Prelude.NFData ListStackResources where
rnf :: ListStackResources -> ()
rnf ListStackResources' {Maybe Text
Text
stackName :: Text
nextToken :: Maybe Text
$sel:stackName:ListStackResources' :: ListStackResources -> Text
$sel:nextToken:ListStackResources' :: ListStackResources -> 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 Text
stackName
instance Data.ToHeaders ListStackResources where
toHeaders :: ListStackResources -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToPath ListStackResources where
toPath :: ListStackResources -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListStackResources where
toQuery :: ListStackResources -> QueryString
toQuery ListStackResources' {Maybe Text
Text
stackName :: Text
nextToken :: Maybe Text
$sel:stackName:ListStackResources' :: ListStackResources -> Text
$sel:nextToken:ListStackResources' :: ListStackResources -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"ListStackResources" :: 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
"StackName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
stackName
]
data ListStackResourcesResponse = ListStackResourcesResponse'
{
ListStackResourcesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListStackResourcesResponse -> Maybe [StackResourceSummary]
stackResourceSummaries :: Prelude.Maybe [StackResourceSummary],
ListStackResourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListStackResourcesResponse -> ListStackResourcesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListStackResourcesResponse -> ListStackResourcesResponse -> Bool
$c/= :: ListStackResourcesResponse -> ListStackResourcesResponse -> Bool
== :: ListStackResourcesResponse -> ListStackResourcesResponse -> Bool
$c== :: ListStackResourcesResponse -> ListStackResourcesResponse -> Bool
Prelude.Eq, ReadPrec [ListStackResourcesResponse]
ReadPrec ListStackResourcesResponse
Int -> ReadS ListStackResourcesResponse
ReadS [ListStackResourcesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListStackResourcesResponse]
$creadListPrec :: ReadPrec [ListStackResourcesResponse]
readPrec :: ReadPrec ListStackResourcesResponse
$creadPrec :: ReadPrec ListStackResourcesResponse
readList :: ReadS [ListStackResourcesResponse]
$creadList :: ReadS [ListStackResourcesResponse]
readsPrec :: Int -> ReadS ListStackResourcesResponse
$creadsPrec :: Int -> ReadS ListStackResourcesResponse
Prelude.Read, Int -> ListStackResourcesResponse -> ShowS
[ListStackResourcesResponse] -> ShowS
ListStackResourcesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListStackResourcesResponse] -> ShowS
$cshowList :: [ListStackResourcesResponse] -> ShowS
show :: ListStackResourcesResponse -> String
$cshow :: ListStackResourcesResponse -> String
showsPrec :: Int -> ListStackResourcesResponse -> ShowS
$cshowsPrec :: Int -> ListStackResourcesResponse -> ShowS
Prelude.Show, forall x.
Rep ListStackResourcesResponse x -> ListStackResourcesResponse
forall x.
ListStackResourcesResponse -> Rep ListStackResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListStackResourcesResponse x -> ListStackResourcesResponse
$cfrom :: forall x.
ListStackResourcesResponse -> Rep ListStackResourcesResponse x
Prelude.Generic)
newListStackResourcesResponse ::
Prelude.Int ->
ListStackResourcesResponse
newListStackResourcesResponse :: Int -> ListStackResourcesResponse
newListStackResourcesResponse Int
pHttpStatus_ =
ListStackResourcesResponse'
{ $sel:nextToken:ListStackResourcesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:stackResourceSummaries:ListStackResourcesResponse' :: Maybe [StackResourceSummary]
stackResourceSummaries = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListStackResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listStackResourcesResponse_nextToken :: Lens.Lens' ListStackResourcesResponse (Prelude.Maybe Prelude.Text)
listStackResourcesResponse_nextToken :: Lens' ListStackResourcesResponse (Maybe Text)
listStackResourcesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackResourcesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListStackResourcesResponse' :: ListStackResourcesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListStackResourcesResponse
s@ListStackResourcesResponse' {} Maybe Text
a -> ListStackResourcesResponse
s {$sel:nextToken:ListStackResourcesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListStackResourcesResponse)
listStackResourcesResponse_stackResourceSummaries :: Lens.Lens' ListStackResourcesResponse (Prelude.Maybe [StackResourceSummary])
listStackResourcesResponse_stackResourceSummaries :: Lens' ListStackResourcesResponse (Maybe [StackResourceSummary])
listStackResourcesResponse_stackResourceSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackResourcesResponse' {Maybe [StackResourceSummary]
stackResourceSummaries :: Maybe [StackResourceSummary]
$sel:stackResourceSummaries:ListStackResourcesResponse' :: ListStackResourcesResponse -> Maybe [StackResourceSummary]
stackResourceSummaries} -> Maybe [StackResourceSummary]
stackResourceSummaries) (\s :: ListStackResourcesResponse
s@ListStackResourcesResponse' {} Maybe [StackResourceSummary]
a -> ListStackResourcesResponse
s {$sel:stackResourceSummaries:ListStackResourcesResponse' :: Maybe [StackResourceSummary]
stackResourceSummaries = Maybe [StackResourceSummary]
a} :: ListStackResourcesResponse) 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
listStackResourcesResponse_httpStatus :: Lens.Lens' ListStackResourcesResponse Prelude.Int
listStackResourcesResponse_httpStatus :: Lens' ListStackResourcesResponse Int
listStackResourcesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListStackResourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListStackResourcesResponse' :: ListStackResourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListStackResourcesResponse
s@ListStackResourcesResponse' {} Int
a -> ListStackResourcesResponse
s {$sel:httpStatus:ListStackResourcesResponse' :: Int
httpStatus = Int
a} :: ListStackResourcesResponse)
instance Prelude.NFData ListStackResourcesResponse where
rnf :: ListStackResourcesResponse -> ()
rnf ListStackResourcesResponse' {Int
Maybe [StackResourceSummary]
Maybe Text
httpStatus :: Int
stackResourceSummaries :: Maybe [StackResourceSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListStackResourcesResponse' :: ListStackResourcesResponse -> Int
$sel:stackResourceSummaries:ListStackResourcesResponse' :: ListStackResourcesResponse -> Maybe [StackResourceSummary]
$sel:nextToken:ListStackResourcesResponse' :: ListStackResourcesResponse -> 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 [StackResourceSummary]
stackResourceSummaries
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus