{-# 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.DescribeStackResources
(
DescribeStackResources (..),
newDescribeStackResources,
describeStackResources_logicalResourceId,
describeStackResources_physicalResourceId,
describeStackResources_stackName,
DescribeStackResourcesResponse (..),
newDescribeStackResourcesResponse,
describeStackResourcesResponse_stackResources,
describeStackResourcesResponse_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 DescribeStackResources = DescribeStackResources'
{
DescribeStackResources -> Maybe Text
logicalResourceId :: Prelude.Maybe Prelude.Text,
DescribeStackResources -> Maybe Text
physicalResourceId :: Prelude.Maybe Prelude.Text,
DescribeStackResources -> Maybe Text
stackName :: Prelude.Maybe Prelude.Text
}
deriving (DescribeStackResources -> DescribeStackResources -> Bool
(DescribeStackResources -> DescribeStackResources -> Bool)
-> (DescribeStackResources -> DescribeStackResources -> Bool)
-> Eq DescribeStackResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStackResources -> DescribeStackResources -> Bool
$c/= :: DescribeStackResources -> DescribeStackResources -> Bool
== :: DescribeStackResources -> DescribeStackResources -> Bool
$c== :: DescribeStackResources -> DescribeStackResources -> Bool
Prelude.Eq, ReadPrec [DescribeStackResources]
ReadPrec DescribeStackResources
Int -> ReadS DescribeStackResources
ReadS [DescribeStackResources]
(Int -> ReadS DescribeStackResources)
-> ReadS [DescribeStackResources]
-> ReadPrec DescribeStackResources
-> ReadPrec [DescribeStackResources]
-> Read DescribeStackResources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStackResources]
$creadListPrec :: ReadPrec [DescribeStackResources]
readPrec :: ReadPrec DescribeStackResources
$creadPrec :: ReadPrec DescribeStackResources
readList :: ReadS [DescribeStackResources]
$creadList :: ReadS [DescribeStackResources]
readsPrec :: Int -> ReadS DescribeStackResources
$creadsPrec :: Int -> ReadS DescribeStackResources
Prelude.Read, Int -> DescribeStackResources -> ShowS
[DescribeStackResources] -> ShowS
DescribeStackResources -> String
(Int -> DescribeStackResources -> ShowS)
-> (DescribeStackResources -> String)
-> ([DescribeStackResources] -> ShowS)
-> Show DescribeStackResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStackResources] -> ShowS
$cshowList :: [DescribeStackResources] -> ShowS
show :: DescribeStackResources -> String
$cshow :: DescribeStackResources -> String
showsPrec :: Int -> DescribeStackResources -> ShowS
$cshowsPrec :: Int -> DescribeStackResources -> ShowS
Prelude.Show, (forall x. DescribeStackResources -> Rep DescribeStackResources x)
-> (forall x.
Rep DescribeStackResources x -> DescribeStackResources)
-> Generic DescribeStackResources
forall x. Rep DescribeStackResources x -> DescribeStackResources
forall x. DescribeStackResources -> Rep DescribeStackResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeStackResources x -> DescribeStackResources
$cfrom :: forall x. DescribeStackResources -> Rep DescribeStackResources x
Prelude.Generic)
newDescribeStackResources ::
DescribeStackResources
newDescribeStackResources :: DescribeStackResources
newDescribeStackResources =
DescribeStackResources' :: Maybe Text -> Maybe Text -> Maybe Text -> DescribeStackResources
DescribeStackResources'
{ $sel:logicalResourceId:DescribeStackResources' :: Maybe Text
logicalResourceId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:physicalResourceId:DescribeStackResources' :: Maybe Text
physicalResourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:stackName:DescribeStackResources' :: Maybe Text
stackName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
describeStackResources_logicalResourceId :: Lens.Lens' DescribeStackResources (Prelude.Maybe Prelude.Text)
describeStackResources_logicalResourceId :: (Maybe Text -> f (Maybe Text))
-> DescribeStackResources -> f DescribeStackResources
describeStackResources_logicalResourceId = (DescribeStackResources -> Maybe Text)
-> (DescribeStackResources -> Maybe Text -> DescribeStackResources)
-> Lens
DescribeStackResources
DescribeStackResources
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackResources' {Maybe Text
logicalResourceId :: Maybe Text
$sel:logicalResourceId:DescribeStackResources' :: DescribeStackResources -> Maybe Text
logicalResourceId} -> Maybe Text
logicalResourceId) (\s :: DescribeStackResources
s@DescribeStackResources' {} Maybe Text
a -> DescribeStackResources
s {$sel:logicalResourceId:DescribeStackResources' :: Maybe Text
logicalResourceId = Maybe Text
a} :: DescribeStackResources)
describeStackResources_physicalResourceId :: Lens.Lens' DescribeStackResources (Prelude.Maybe Prelude.Text)
describeStackResources_physicalResourceId :: (Maybe Text -> f (Maybe Text))
-> DescribeStackResources -> f DescribeStackResources
describeStackResources_physicalResourceId = (DescribeStackResources -> Maybe Text)
-> (DescribeStackResources -> Maybe Text -> DescribeStackResources)
-> Lens
DescribeStackResources
DescribeStackResources
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackResources' {Maybe Text
physicalResourceId :: Maybe Text
$sel:physicalResourceId:DescribeStackResources' :: DescribeStackResources -> Maybe Text
physicalResourceId} -> Maybe Text
physicalResourceId) (\s :: DescribeStackResources
s@DescribeStackResources' {} Maybe Text
a -> DescribeStackResources
s {$sel:physicalResourceId:DescribeStackResources' :: Maybe Text
physicalResourceId = Maybe Text
a} :: DescribeStackResources)
describeStackResources_stackName :: Lens.Lens' DescribeStackResources (Prelude.Maybe Prelude.Text)
describeStackResources_stackName :: (Maybe Text -> f (Maybe Text))
-> DescribeStackResources -> f DescribeStackResources
describeStackResources_stackName = (DescribeStackResources -> Maybe Text)
-> (DescribeStackResources -> Maybe Text -> DescribeStackResources)
-> Lens
DescribeStackResources
DescribeStackResources
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackResources' {Maybe Text
stackName :: Maybe Text
$sel:stackName:DescribeStackResources' :: DescribeStackResources -> Maybe Text
stackName} -> Maybe Text
stackName) (\s :: DescribeStackResources
s@DescribeStackResources' {} Maybe Text
a -> DescribeStackResources
s {$sel:stackName:DescribeStackResources' :: Maybe Text
stackName = Maybe Text
a} :: DescribeStackResources)
instance Core.AWSRequest DescribeStackResources where
type
AWSResponse DescribeStackResources =
DescribeStackResourcesResponse
request :: DescribeStackResources -> Request DescribeStackResources
request = Service -> DescribeStackResources -> Request DescribeStackResources
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeStackResources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeStackResources)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse DescribeStackResources))
-> Logger
-> Service
-> Proxy DescribeStackResources
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeStackResources)))
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
"DescribeStackResourcesResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [StackResource] -> Int -> DescribeStackResourcesResponse
DescribeStackResourcesResponse'
(Maybe [StackResource] -> Int -> DescribeStackResourcesResponse)
-> Either String (Maybe [StackResource])
-> Either String (Int -> DescribeStackResourcesResponse)
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
"StackResources" 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 [StackResource]))
-> Either String (Maybe [StackResource])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [StackResource])
-> [Node] -> Either String (Maybe [StackResource])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [StackResource]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Int -> DescribeStackResourcesResponse)
-> Either String Int
-> Either String DescribeStackResourcesResponse
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 DescribeStackResources
instance Prelude.NFData DescribeStackResources
instance Core.ToHeaders DescribeStackResources where
toHeaders :: DescribeStackResources -> ResponseHeaders
toHeaders = ResponseHeaders -> DescribeStackResources -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath DescribeStackResources where
toPath :: DescribeStackResources -> ByteString
toPath = ByteString -> DescribeStackResources -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeStackResources where
toQuery :: DescribeStackResources -> QueryString
toQuery DescribeStackResources' {Maybe Text
stackName :: Maybe Text
physicalResourceId :: Maybe Text
logicalResourceId :: Maybe Text
$sel:stackName:DescribeStackResources' :: DescribeStackResources -> Maybe Text
$sel:physicalResourceId:DescribeStackResources' :: DescribeStackResources -> Maybe Text
$sel:logicalResourceId:DescribeStackResources' :: DescribeStackResources -> 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
"DescribeStackResources" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
ByteString
"LogicalResourceId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
logicalResourceId,
ByteString
"PhysicalResourceId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
physicalResourceId,
ByteString
"StackName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
stackName
]
data DescribeStackResourcesResponse = DescribeStackResourcesResponse'
{
DescribeStackResourcesResponse -> Maybe [StackResource]
stackResources :: Prelude.Maybe [StackResource],
DescribeStackResourcesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeStackResourcesResponse
-> DescribeStackResourcesResponse -> Bool
(DescribeStackResourcesResponse
-> DescribeStackResourcesResponse -> Bool)
-> (DescribeStackResourcesResponse
-> DescribeStackResourcesResponse -> Bool)
-> Eq DescribeStackResourcesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStackResourcesResponse
-> DescribeStackResourcesResponse -> Bool
$c/= :: DescribeStackResourcesResponse
-> DescribeStackResourcesResponse -> Bool
== :: DescribeStackResourcesResponse
-> DescribeStackResourcesResponse -> Bool
$c== :: DescribeStackResourcesResponse
-> DescribeStackResourcesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeStackResourcesResponse]
ReadPrec DescribeStackResourcesResponse
Int -> ReadS DescribeStackResourcesResponse
ReadS [DescribeStackResourcesResponse]
(Int -> ReadS DescribeStackResourcesResponse)
-> ReadS [DescribeStackResourcesResponse]
-> ReadPrec DescribeStackResourcesResponse
-> ReadPrec [DescribeStackResourcesResponse]
-> Read DescribeStackResourcesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStackResourcesResponse]
$creadListPrec :: ReadPrec [DescribeStackResourcesResponse]
readPrec :: ReadPrec DescribeStackResourcesResponse
$creadPrec :: ReadPrec DescribeStackResourcesResponse
readList :: ReadS [DescribeStackResourcesResponse]
$creadList :: ReadS [DescribeStackResourcesResponse]
readsPrec :: Int -> ReadS DescribeStackResourcesResponse
$creadsPrec :: Int -> ReadS DescribeStackResourcesResponse
Prelude.Read, Int -> DescribeStackResourcesResponse -> ShowS
[DescribeStackResourcesResponse] -> ShowS
DescribeStackResourcesResponse -> String
(Int -> DescribeStackResourcesResponse -> ShowS)
-> (DescribeStackResourcesResponse -> String)
-> ([DescribeStackResourcesResponse] -> ShowS)
-> Show DescribeStackResourcesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStackResourcesResponse] -> ShowS
$cshowList :: [DescribeStackResourcesResponse] -> ShowS
show :: DescribeStackResourcesResponse -> String
$cshow :: DescribeStackResourcesResponse -> String
showsPrec :: Int -> DescribeStackResourcesResponse -> ShowS
$cshowsPrec :: Int -> DescribeStackResourcesResponse -> ShowS
Prelude.Show, (forall x.
DescribeStackResourcesResponse
-> Rep DescribeStackResourcesResponse x)
-> (forall x.
Rep DescribeStackResourcesResponse x
-> DescribeStackResourcesResponse)
-> Generic DescribeStackResourcesResponse
forall x.
Rep DescribeStackResourcesResponse x
-> DescribeStackResourcesResponse
forall x.
DescribeStackResourcesResponse
-> Rep DescribeStackResourcesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeStackResourcesResponse x
-> DescribeStackResourcesResponse
$cfrom :: forall x.
DescribeStackResourcesResponse
-> Rep DescribeStackResourcesResponse x
Prelude.Generic)
newDescribeStackResourcesResponse ::
Prelude.Int ->
DescribeStackResourcesResponse
newDescribeStackResourcesResponse :: Int -> DescribeStackResourcesResponse
newDescribeStackResourcesResponse Int
pHttpStatus_ =
DescribeStackResourcesResponse' :: Maybe [StackResource] -> Int -> DescribeStackResourcesResponse
DescribeStackResourcesResponse'
{ $sel:stackResources:DescribeStackResourcesResponse' :: Maybe [StackResource]
stackResources =
Maybe [StackResource]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeStackResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeStackResourcesResponse_stackResources :: Lens.Lens' DescribeStackResourcesResponse (Prelude.Maybe [StackResource])
describeStackResourcesResponse_stackResources :: (Maybe [StackResource] -> f (Maybe [StackResource]))
-> DescribeStackResourcesResponse
-> f DescribeStackResourcesResponse
describeStackResourcesResponse_stackResources = (DescribeStackResourcesResponse -> Maybe [StackResource])
-> (DescribeStackResourcesResponse
-> Maybe [StackResource] -> DescribeStackResourcesResponse)
-> Lens
DescribeStackResourcesResponse
DescribeStackResourcesResponse
(Maybe [StackResource])
(Maybe [StackResource])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackResourcesResponse' {Maybe [StackResource]
stackResources :: Maybe [StackResource]
$sel:stackResources:DescribeStackResourcesResponse' :: DescribeStackResourcesResponse -> Maybe [StackResource]
stackResources} -> Maybe [StackResource]
stackResources) (\s :: DescribeStackResourcesResponse
s@DescribeStackResourcesResponse' {} Maybe [StackResource]
a -> DescribeStackResourcesResponse
s {$sel:stackResources:DescribeStackResourcesResponse' :: Maybe [StackResource]
stackResources = Maybe [StackResource]
a} :: DescribeStackResourcesResponse) ((Maybe [StackResource] -> f (Maybe [StackResource]))
-> DescribeStackResourcesResponse
-> f DescribeStackResourcesResponse)
-> ((Maybe [StackResource] -> f (Maybe [StackResource]))
-> Maybe [StackResource] -> f (Maybe [StackResource]))
-> (Maybe [StackResource] -> f (Maybe [StackResource]))
-> DescribeStackResourcesResponse
-> f DescribeStackResourcesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[StackResource] [StackResource] [StackResource] [StackResource]
-> Iso
(Maybe [StackResource])
(Maybe [StackResource])
(Maybe [StackResource])
(Maybe [StackResource])
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
[StackResource] [StackResource] [StackResource] [StackResource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
describeStackResourcesResponse_httpStatus :: Lens.Lens' DescribeStackResourcesResponse Prelude.Int
describeStackResourcesResponse_httpStatus :: (Int -> f Int)
-> DescribeStackResourcesResponse
-> f DescribeStackResourcesResponse
describeStackResourcesResponse_httpStatus = (DescribeStackResourcesResponse -> Int)
-> (DescribeStackResourcesResponse
-> Int -> DescribeStackResourcesResponse)
-> Lens
DescribeStackResourcesResponse
DescribeStackResourcesResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackResourcesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeStackResourcesResponse' :: DescribeStackResourcesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeStackResourcesResponse
s@DescribeStackResourcesResponse' {} Int
a -> DescribeStackResourcesResponse
s {$sel:httpStatus:DescribeStackResourcesResponse' :: Int
httpStatus = Int
a} :: DescribeStackResourcesResponse)
instance
Prelude.NFData
DescribeStackResourcesResponse