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