{-# 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.GetTemplate
(
GetTemplate (..),
newGetTemplate,
getTemplate_changeSetName,
getTemplate_templateStage,
getTemplate_stackName,
GetTemplateResponse (..),
newGetTemplateResponse,
getTemplateResponse_stagesAvailable,
getTemplateResponse_templateBody,
getTemplateResponse_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 GetTemplate = GetTemplate'
{
GetTemplate -> Maybe Text
changeSetName :: Prelude.Maybe Prelude.Text,
GetTemplate -> Maybe TemplateStage
templateStage :: Prelude.Maybe TemplateStage,
GetTemplate -> Maybe Text
stackName :: Prelude.Maybe Prelude.Text
}
deriving (GetTemplate -> GetTemplate -> Bool
(GetTemplate -> GetTemplate -> Bool)
-> (GetTemplate -> GetTemplate -> Bool) -> Eq GetTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTemplate -> GetTemplate -> Bool
$c/= :: GetTemplate -> GetTemplate -> Bool
== :: GetTemplate -> GetTemplate -> Bool
$c== :: GetTemplate -> GetTemplate -> Bool
Prelude.Eq, ReadPrec [GetTemplate]
ReadPrec GetTemplate
Int -> ReadS GetTemplate
ReadS [GetTemplate]
(Int -> ReadS GetTemplate)
-> ReadS [GetTemplate]
-> ReadPrec GetTemplate
-> ReadPrec [GetTemplate]
-> Read GetTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTemplate]
$creadListPrec :: ReadPrec [GetTemplate]
readPrec :: ReadPrec GetTemplate
$creadPrec :: ReadPrec GetTemplate
readList :: ReadS [GetTemplate]
$creadList :: ReadS [GetTemplate]
readsPrec :: Int -> ReadS GetTemplate
$creadsPrec :: Int -> ReadS GetTemplate
Prelude.Read, Int -> GetTemplate -> ShowS
[GetTemplate] -> ShowS
GetTemplate -> String
(Int -> GetTemplate -> ShowS)
-> (GetTemplate -> String)
-> ([GetTemplate] -> ShowS)
-> Show GetTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTemplate] -> ShowS
$cshowList :: [GetTemplate] -> ShowS
show :: GetTemplate -> String
$cshow :: GetTemplate -> String
showsPrec :: Int -> GetTemplate -> ShowS
$cshowsPrec :: Int -> GetTemplate -> ShowS
Prelude.Show, (forall x. GetTemplate -> Rep GetTemplate x)
-> (forall x. Rep GetTemplate x -> GetTemplate)
-> Generic GetTemplate
forall x. Rep GetTemplate x -> GetTemplate
forall x. GetTemplate -> Rep GetTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTemplate x -> GetTemplate
$cfrom :: forall x. GetTemplate -> Rep GetTemplate x
Prelude.Generic)
newGetTemplate ::
GetTemplate
newGetTemplate :: GetTemplate
newGetTemplate =
GetTemplate' :: Maybe Text -> Maybe TemplateStage -> Maybe Text -> GetTemplate
GetTemplate'
{ $sel:changeSetName:GetTemplate' :: Maybe Text
changeSetName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:templateStage:GetTemplate' :: Maybe TemplateStage
templateStage = Maybe TemplateStage
forall a. Maybe a
Prelude.Nothing,
$sel:stackName:GetTemplate' :: Maybe Text
stackName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
getTemplate_changeSetName :: Lens.Lens' GetTemplate (Prelude.Maybe Prelude.Text)
getTemplate_changeSetName :: (Maybe Text -> f (Maybe Text)) -> GetTemplate -> f GetTemplate
getTemplate_changeSetName = (GetTemplate -> Maybe Text)
-> (GetTemplate -> Maybe Text -> GetTemplate)
-> Lens GetTemplate GetTemplate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplate' {Maybe Text
changeSetName :: Maybe Text
$sel:changeSetName:GetTemplate' :: GetTemplate -> Maybe Text
changeSetName} -> Maybe Text
changeSetName) (\s :: GetTemplate
s@GetTemplate' {} Maybe Text
a -> GetTemplate
s {$sel:changeSetName:GetTemplate' :: Maybe Text
changeSetName = Maybe Text
a} :: GetTemplate)
getTemplate_templateStage :: Lens.Lens' GetTemplate (Prelude.Maybe TemplateStage)
getTemplate_templateStage :: (Maybe TemplateStage -> f (Maybe TemplateStage))
-> GetTemplate -> f GetTemplate
getTemplate_templateStage = (GetTemplate -> Maybe TemplateStage)
-> (GetTemplate -> Maybe TemplateStage -> GetTemplate)
-> Lens
GetTemplate GetTemplate (Maybe TemplateStage) (Maybe TemplateStage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplate' {Maybe TemplateStage
templateStage :: Maybe TemplateStage
$sel:templateStage:GetTemplate' :: GetTemplate -> Maybe TemplateStage
templateStage} -> Maybe TemplateStage
templateStage) (\s :: GetTemplate
s@GetTemplate' {} Maybe TemplateStage
a -> GetTemplate
s {$sel:templateStage:GetTemplate' :: Maybe TemplateStage
templateStage = Maybe TemplateStage
a} :: GetTemplate)
getTemplate_stackName :: Lens.Lens' GetTemplate (Prelude.Maybe Prelude.Text)
getTemplate_stackName :: (Maybe Text -> f (Maybe Text)) -> GetTemplate -> f GetTemplate
getTemplate_stackName = (GetTemplate -> Maybe Text)
-> (GetTemplate -> Maybe Text -> GetTemplate)
-> Lens GetTemplate GetTemplate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplate' {Maybe Text
stackName :: Maybe Text
$sel:stackName:GetTemplate' :: GetTemplate -> Maybe Text
stackName} -> Maybe Text
stackName) (\s :: GetTemplate
s@GetTemplate' {} Maybe Text
a -> GetTemplate
s {$sel:stackName:GetTemplate' :: Maybe Text
stackName = Maybe Text
a} :: GetTemplate)
instance Core.AWSRequest GetTemplate where
type AWSResponse GetTemplate = GetTemplateResponse
request :: GetTemplate -> Request GetTemplate
request = Service -> GetTemplate -> Request GetTemplate
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTemplate)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetTemplate))
-> Logger
-> Service
-> Proxy GetTemplate
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetTemplate)))
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
"GetTemplateResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe [TemplateStage] -> Maybe Text -> Int -> GetTemplateResponse
GetTemplateResponse'
(Maybe [TemplateStage] -> Maybe Text -> Int -> GetTemplateResponse)
-> Either String (Maybe [TemplateStage])
-> Either String (Maybe Text -> Int -> GetTemplateResponse)
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
"StagesAvailable" 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 [TemplateStage]))
-> Either String (Maybe [TemplateStage])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [TemplateStage])
-> [Node] -> Either String (Maybe [TemplateStage])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [TemplateStage]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Maybe Text -> Int -> GetTemplateResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetTemplateResponse)
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
"TemplateBody")
Either String (Int -> GetTemplateResponse)
-> Either String Int -> Either String GetTemplateResponse
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 GetTemplate
instance Prelude.NFData GetTemplate
instance Core.ToHeaders GetTemplate where
toHeaders :: GetTemplate -> ResponseHeaders
toHeaders = ResponseHeaders -> GetTemplate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetTemplate where
toPath :: GetTemplate -> ByteString
toPath = ByteString -> GetTemplate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetTemplate where
toQuery :: GetTemplate -> QueryString
toQuery GetTemplate' {Maybe Text
Maybe TemplateStage
stackName :: Maybe Text
templateStage :: Maybe TemplateStage
changeSetName :: Maybe Text
$sel:stackName:GetTemplate' :: GetTemplate -> Maybe Text
$sel:templateStage:GetTemplate' :: GetTemplate -> Maybe TemplateStage
$sel:changeSetName:GetTemplate' :: GetTemplate -> 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
"GetTemplate" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
ByteString
"ChangeSetName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
changeSetName,
ByteString
"TemplateStage" ByteString -> Maybe TemplateStage -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe TemplateStage
templateStage,
ByteString
"StackName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
stackName
]
data GetTemplateResponse = GetTemplateResponse'
{
GetTemplateResponse -> Maybe [TemplateStage]
stagesAvailable :: Prelude.Maybe [TemplateStage],
GetTemplateResponse -> Maybe Text
templateBody :: Prelude.Maybe Prelude.Text,
GetTemplateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetTemplateResponse -> GetTemplateResponse -> Bool
(GetTemplateResponse -> GetTemplateResponse -> Bool)
-> (GetTemplateResponse -> GetTemplateResponse -> Bool)
-> Eq GetTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetTemplateResponse -> GetTemplateResponse -> Bool
$c/= :: GetTemplateResponse -> GetTemplateResponse -> Bool
== :: GetTemplateResponse -> GetTemplateResponse -> Bool
$c== :: GetTemplateResponse -> GetTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetTemplateResponse]
ReadPrec GetTemplateResponse
Int -> ReadS GetTemplateResponse
ReadS [GetTemplateResponse]
(Int -> ReadS GetTemplateResponse)
-> ReadS [GetTemplateResponse]
-> ReadPrec GetTemplateResponse
-> ReadPrec [GetTemplateResponse]
-> Read GetTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetTemplateResponse]
$creadListPrec :: ReadPrec [GetTemplateResponse]
readPrec :: ReadPrec GetTemplateResponse
$creadPrec :: ReadPrec GetTemplateResponse
readList :: ReadS [GetTemplateResponse]
$creadList :: ReadS [GetTemplateResponse]
readsPrec :: Int -> ReadS GetTemplateResponse
$creadsPrec :: Int -> ReadS GetTemplateResponse
Prelude.Read, Int -> GetTemplateResponse -> ShowS
[GetTemplateResponse] -> ShowS
GetTemplateResponse -> String
(Int -> GetTemplateResponse -> ShowS)
-> (GetTemplateResponse -> String)
-> ([GetTemplateResponse] -> ShowS)
-> Show GetTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetTemplateResponse] -> ShowS
$cshowList :: [GetTemplateResponse] -> ShowS
show :: GetTemplateResponse -> String
$cshow :: GetTemplateResponse -> String
showsPrec :: Int -> GetTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetTemplateResponse -> ShowS
Prelude.Show, (forall x. GetTemplateResponse -> Rep GetTemplateResponse x)
-> (forall x. Rep GetTemplateResponse x -> GetTemplateResponse)
-> Generic GetTemplateResponse
forall x. Rep GetTemplateResponse x -> GetTemplateResponse
forall x. GetTemplateResponse -> Rep GetTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetTemplateResponse x -> GetTemplateResponse
$cfrom :: forall x. GetTemplateResponse -> Rep GetTemplateResponse x
Prelude.Generic)
newGetTemplateResponse ::
Prelude.Int ->
GetTemplateResponse
newGetTemplateResponse :: Int -> GetTemplateResponse
newGetTemplateResponse Int
pHttpStatus_ =
GetTemplateResponse' :: Maybe [TemplateStage] -> Maybe Text -> Int -> GetTemplateResponse
GetTemplateResponse'
{ $sel:stagesAvailable:GetTemplateResponse' :: Maybe [TemplateStage]
stagesAvailable =
Maybe [TemplateStage]
forall a. Maybe a
Prelude.Nothing,
$sel:templateBody:GetTemplateResponse' :: Maybe Text
templateBody = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getTemplateResponse_stagesAvailable :: Lens.Lens' GetTemplateResponse (Prelude.Maybe [TemplateStage])
getTemplateResponse_stagesAvailable :: (Maybe [TemplateStage] -> f (Maybe [TemplateStage]))
-> GetTemplateResponse -> f GetTemplateResponse
getTemplateResponse_stagesAvailable = (GetTemplateResponse -> Maybe [TemplateStage])
-> (GetTemplateResponse
-> Maybe [TemplateStage] -> GetTemplateResponse)
-> Lens
GetTemplateResponse
GetTemplateResponse
(Maybe [TemplateStage])
(Maybe [TemplateStage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Maybe [TemplateStage]
stagesAvailable :: Maybe [TemplateStage]
$sel:stagesAvailable:GetTemplateResponse' :: GetTemplateResponse -> Maybe [TemplateStage]
stagesAvailable} -> Maybe [TemplateStage]
stagesAvailable) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Maybe [TemplateStage]
a -> GetTemplateResponse
s {$sel:stagesAvailable:GetTemplateResponse' :: Maybe [TemplateStage]
stagesAvailable = Maybe [TemplateStage]
a} :: GetTemplateResponse) ((Maybe [TemplateStage] -> f (Maybe [TemplateStage]))
-> GetTemplateResponse -> f GetTemplateResponse)
-> ((Maybe [TemplateStage] -> f (Maybe [TemplateStage]))
-> Maybe [TemplateStage] -> f (Maybe [TemplateStage]))
-> (Maybe [TemplateStage] -> f (Maybe [TemplateStage]))
-> GetTemplateResponse
-> f GetTemplateResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[TemplateStage] [TemplateStage] [TemplateStage] [TemplateStage]
-> Iso
(Maybe [TemplateStage])
(Maybe [TemplateStage])
(Maybe [TemplateStage])
(Maybe [TemplateStage])
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
[TemplateStage] [TemplateStage] [TemplateStage] [TemplateStage]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getTemplateResponse_templateBody :: Lens.Lens' GetTemplateResponse (Prelude.Maybe Prelude.Text)
getTemplateResponse_templateBody :: (Maybe Text -> f (Maybe Text))
-> GetTemplateResponse -> f GetTemplateResponse
getTemplateResponse_templateBody = (GetTemplateResponse -> Maybe Text)
-> (GetTemplateResponse -> Maybe Text -> GetTemplateResponse)
-> Lens
GetTemplateResponse GetTemplateResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Maybe Text
templateBody :: Maybe Text
$sel:templateBody:GetTemplateResponse' :: GetTemplateResponse -> Maybe Text
templateBody} -> Maybe Text
templateBody) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Maybe Text
a -> GetTemplateResponse
s {$sel:templateBody:GetTemplateResponse' :: Maybe Text
templateBody = Maybe Text
a} :: GetTemplateResponse)
getTemplateResponse_httpStatus :: Lens.Lens' GetTemplateResponse Prelude.Int
getTemplateResponse_httpStatus :: (Int -> f Int) -> GetTemplateResponse -> f GetTemplateResponse
getTemplateResponse_httpStatus = (GetTemplateResponse -> Int)
-> (GetTemplateResponse -> Int -> GetTemplateResponse)
-> Lens GetTemplateResponse GetTemplateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetTemplateResponse' :: GetTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetTemplateResponse
s@GetTemplateResponse' {} Int
a -> GetTemplateResponse
s {$sel:httpStatus:GetTemplateResponse' :: Int
httpStatus = Int
a} :: GetTemplateResponse)
instance Prelude.NFData GetTemplateResponse