{-# 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.GetStackPolicy
(
GetStackPolicy (..),
newGetStackPolicy,
getStackPolicy_stackName,
GetStackPolicyResponse (..),
newGetStackPolicyResponse,
getStackPolicyResponse_stackPolicyBody,
getStackPolicyResponse_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 GetStackPolicy = GetStackPolicy'
{
GetStackPolicy -> Text
stackName :: Prelude.Text
}
deriving (GetStackPolicy -> GetStackPolicy -> Bool
(GetStackPolicy -> GetStackPolicy -> Bool)
-> (GetStackPolicy -> GetStackPolicy -> Bool) -> Eq GetStackPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStackPolicy -> GetStackPolicy -> Bool
$c/= :: GetStackPolicy -> GetStackPolicy -> Bool
== :: GetStackPolicy -> GetStackPolicy -> Bool
$c== :: GetStackPolicy -> GetStackPolicy -> Bool
Prelude.Eq, ReadPrec [GetStackPolicy]
ReadPrec GetStackPolicy
Int -> ReadS GetStackPolicy
ReadS [GetStackPolicy]
(Int -> ReadS GetStackPolicy)
-> ReadS [GetStackPolicy]
-> ReadPrec GetStackPolicy
-> ReadPrec [GetStackPolicy]
-> Read GetStackPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStackPolicy]
$creadListPrec :: ReadPrec [GetStackPolicy]
readPrec :: ReadPrec GetStackPolicy
$creadPrec :: ReadPrec GetStackPolicy
readList :: ReadS [GetStackPolicy]
$creadList :: ReadS [GetStackPolicy]
readsPrec :: Int -> ReadS GetStackPolicy
$creadsPrec :: Int -> ReadS GetStackPolicy
Prelude.Read, Int -> GetStackPolicy -> ShowS
[GetStackPolicy] -> ShowS
GetStackPolicy -> String
(Int -> GetStackPolicy -> ShowS)
-> (GetStackPolicy -> String)
-> ([GetStackPolicy] -> ShowS)
-> Show GetStackPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStackPolicy] -> ShowS
$cshowList :: [GetStackPolicy] -> ShowS
show :: GetStackPolicy -> String
$cshow :: GetStackPolicy -> String
showsPrec :: Int -> GetStackPolicy -> ShowS
$cshowsPrec :: Int -> GetStackPolicy -> ShowS
Prelude.Show, (forall x. GetStackPolicy -> Rep GetStackPolicy x)
-> (forall x. Rep GetStackPolicy x -> GetStackPolicy)
-> Generic GetStackPolicy
forall x. Rep GetStackPolicy x -> GetStackPolicy
forall x. GetStackPolicy -> Rep GetStackPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStackPolicy x -> GetStackPolicy
$cfrom :: forall x. GetStackPolicy -> Rep GetStackPolicy x
Prelude.Generic)
newGetStackPolicy ::
Prelude.Text ->
GetStackPolicy
newGetStackPolicy :: Text -> GetStackPolicy
newGetStackPolicy Text
pStackName_ =
GetStackPolicy' :: Text -> GetStackPolicy
GetStackPolicy' {$sel:stackName:GetStackPolicy' :: Text
stackName = Text
pStackName_}
getStackPolicy_stackName :: Lens.Lens' GetStackPolicy Prelude.Text
getStackPolicy_stackName :: (Text -> f Text) -> GetStackPolicy -> f GetStackPolicy
getStackPolicy_stackName = (GetStackPolicy -> Text)
-> (GetStackPolicy -> Text -> GetStackPolicy)
-> Lens GetStackPolicy GetStackPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStackPolicy' {Text
stackName :: Text
$sel:stackName:GetStackPolicy' :: GetStackPolicy -> Text
stackName} -> Text
stackName) (\s :: GetStackPolicy
s@GetStackPolicy' {} Text
a -> GetStackPolicy
s {$sel:stackName:GetStackPolicy' :: Text
stackName = Text
a} :: GetStackPolicy)
instance Core.AWSRequest GetStackPolicy where
type
AWSResponse GetStackPolicy =
GetStackPolicyResponse
request :: GetStackPolicy -> Request GetStackPolicy
request = Service -> GetStackPolicy -> Request GetStackPolicy
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy GetStackPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStackPolicy)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetStackPolicy))
-> Logger
-> Service
-> Proxy GetStackPolicy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStackPolicy)))
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
"GetStackPolicyResult"
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Text -> Int -> GetStackPolicyResponse
GetStackPolicyResponse'
(Maybe Text -> Int -> GetStackPolicyResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetStackPolicyResponse)
forall (f :: * -> *) a b. Functor 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
"StackPolicyBody")
Either String (Int -> GetStackPolicyResponse)
-> Either String Int -> Either String GetStackPolicyResponse
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 GetStackPolicy
instance Prelude.NFData GetStackPolicy
instance Core.ToHeaders GetStackPolicy where
toHeaders :: GetStackPolicy -> ResponseHeaders
toHeaders = ResponseHeaders -> GetStackPolicy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetStackPolicy where
toPath :: GetStackPolicy -> ByteString
toPath = ByteString -> GetStackPolicy -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetStackPolicy where
toQuery :: GetStackPolicy -> QueryString
toQuery GetStackPolicy' {Text
stackName :: Text
$sel:stackName:GetStackPolicy' :: GetStackPolicy -> 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
"GetStackPolicy" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
ByteString
"StackName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
stackName
]
data GetStackPolicyResponse = GetStackPolicyResponse'
{
GetStackPolicyResponse -> Maybe Text
stackPolicyBody :: Prelude.Maybe Prelude.Text,
GetStackPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetStackPolicyResponse -> GetStackPolicyResponse -> Bool
(GetStackPolicyResponse -> GetStackPolicyResponse -> Bool)
-> (GetStackPolicyResponse -> GetStackPolicyResponse -> Bool)
-> Eq GetStackPolicyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStackPolicyResponse -> GetStackPolicyResponse -> Bool
$c/= :: GetStackPolicyResponse -> GetStackPolicyResponse -> Bool
== :: GetStackPolicyResponse -> GetStackPolicyResponse -> Bool
$c== :: GetStackPolicyResponse -> GetStackPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetStackPolicyResponse]
ReadPrec GetStackPolicyResponse
Int -> ReadS GetStackPolicyResponse
ReadS [GetStackPolicyResponse]
(Int -> ReadS GetStackPolicyResponse)
-> ReadS [GetStackPolicyResponse]
-> ReadPrec GetStackPolicyResponse
-> ReadPrec [GetStackPolicyResponse]
-> Read GetStackPolicyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStackPolicyResponse]
$creadListPrec :: ReadPrec [GetStackPolicyResponse]
readPrec :: ReadPrec GetStackPolicyResponse
$creadPrec :: ReadPrec GetStackPolicyResponse
readList :: ReadS [GetStackPolicyResponse]
$creadList :: ReadS [GetStackPolicyResponse]
readsPrec :: Int -> ReadS GetStackPolicyResponse
$creadsPrec :: Int -> ReadS GetStackPolicyResponse
Prelude.Read, Int -> GetStackPolicyResponse -> ShowS
[GetStackPolicyResponse] -> ShowS
GetStackPolicyResponse -> String
(Int -> GetStackPolicyResponse -> ShowS)
-> (GetStackPolicyResponse -> String)
-> ([GetStackPolicyResponse] -> ShowS)
-> Show GetStackPolicyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStackPolicyResponse] -> ShowS
$cshowList :: [GetStackPolicyResponse] -> ShowS
show :: GetStackPolicyResponse -> String
$cshow :: GetStackPolicyResponse -> String
showsPrec :: Int -> GetStackPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetStackPolicyResponse -> ShowS
Prelude.Show, (forall x. GetStackPolicyResponse -> Rep GetStackPolicyResponse x)
-> (forall x.
Rep GetStackPolicyResponse x -> GetStackPolicyResponse)
-> Generic GetStackPolicyResponse
forall x. Rep GetStackPolicyResponse x -> GetStackPolicyResponse
forall x. GetStackPolicyResponse -> Rep GetStackPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStackPolicyResponse x -> GetStackPolicyResponse
$cfrom :: forall x. GetStackPolicyResponse -> Rep GetStackPolicyResponse x
Prelude.Generic)
newGetStackPolicyResponse ::
Prelude.Int ->
GetStackPolicyResponse
newGetStackPolicyResponse :: Int -> GetStackPolicyResponse
newGetStackPolicyResponse Int
pHttpStatus_ =
GetStackPolicyResponse' :: Maybe Text -> Int -> GetStackPolicyResponse
GetStackPolicyResponse'
{ $sel:stackPolicyBody:GetStackPolicyResponse' :: Maybe Text
stackPolicyBody =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetStackPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getStackPolicyResponse_stackPolicyBody :: Lens.Lens' GetStackPolicyResponse (Prelude.Maybe Prelude.Text)
getStackPolicyResponse_stackPolicyBody :: (Maybe Text -> f (Maybe Text))
-> GetStackPolicyResponse -> f GetStackPolicyResponse
getStackPolicyResponse_stackPolicyBody = (GetStackPolicyResponse -> Maybe Text)
-> (GetStackPolicyResponse -> Maybe Text -> GetStackPolicyResponse)
-> Lens
GetStackPolicyResponse
GetStackPolicyResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStackPolicyResponse' {Maybe Text
stackPolicyBody :: Maybe Text
$sel:stackPolicyBody:GetStackPolicyResponse' :: GetStackPolicyResponse -> Maybe Text
stackPolicyBody} -> Maybe Text
stackPolicyBody) (\s :: GetStackPolicyResponse
s@GetStackPolicyResponse' {} Maybe Text
a -> GetStackPolicyResponse
s {$sel:stackPolicyBody:GetStackPolicyResponse' :: Maybe Text
stackPolicyBody = Maybe Text
a} :: GetStackPolicyResponse)
getStackPolicyResponse_httpStatus :: Lens.Lens' GetStackPolicyResponse Prelude.Int
getStackPolicyResponse_httpStatus :: (Int -> f Int)
-> GetStackPolicyResponse -> f GetStackPolicyResponse
getStackPolicyResponse_httpStatus = (GetStackPolicyResponse -> Int)
-> (GetStackPolicyResponse -> Int -> GetStackPolicyResponse)
-> Lens GetStackPolicyResponse GetStackPolicyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStackPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetStackPolicyResponse' :: GetStackPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetStackPolicyResponse
s@GetStackPolicyResponse' {} Int
a -> GetStackPolicyResponse
s {$sel:httpStatus:GetStackPolicyResponse' :: Int
httpStatus = Int
a} :: GetStackPolicyResponse)
instance Prelude.NFData GetStackPolicyResponse