{-# 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.CodeCommit.GetApprovalRuleTemplate
(
GetApprovalRuleTemplate (..),
newGetApprovalRuleTemplate,
getApprovalRuleTemplate_approvalRuleTemplateName,
GetApprovalRuleTemplateResponse (..),
newGetApprovalRuleTemplateResponse,
getApprovalRuleTemplateResponse_httpStatus,
getApprovalRuleTemplateResponse_approvalRuleTemplate,
)
where
import Amazonka.CodeCommit.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 GetApprovalRuleTemplate = GetApprovalRuleTemplate'
{
GetApprovalRuleTemplate -> Text
approvalRuleTemplateName :: Prelude.Text
}
deriving (GetApprovalRuleTemplate -> GetApprovalRuleTemplate -> Bool
(GetApprovalRuleTemplate -> GetApprovalRuleTemplate -> Bool)
-> (GetApprovalRuleTemplate -> GetApprovalRuleTemplate -> Bool)
-> Eq GetApprovalRuleTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApprovalRuleTemplate -> GetApprovalRuleTemplate -> Bool
$c/= :: GetApprovalRuleTemplate -> GetApprovalRuleTemplate -> Bool
== :: GetApprovalRuleTemplate -> GetApprovalRuleTemplate -> Bool
$c== :: GetApprovalRuleTemplate -> GetApprovalRuleTemplate -> Bool
Prelude.Eq, ReadPrec [GetApprovalRuleTemplate]
ReadPrec GetApprovalRuleTemplate
Int -> ReadS GetApprovalRuleTemplate
ReadS [GetApprovalRuleTemplate]
(Int -> ReadS GetApprovalRuleTemplate)
-> ReadS [GetApprovalRuleTemplate]
-> ReadPrec GetApprovalRuleTemplate
-> ReadPrec [GetApprovalRuleTemplate]
-> Read GetApprovalRuleTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApprovalRuleTemplate]
$creadListPrec :: ReadPrec [GetApprovalRuleTemplate]
readPrec :: ReadPrec GetApprovalRuleTemplate
$creadPrec :: ReadPrec GetApprovalRuleTemplate
readList :: ReadS [GetApprovalRuleTemplate]
$creadList :: ReadS [GetApprovalRuleTemplate]
readsPrec :: Int -> ReadS GetApprovalRuleTemplate
$creadsPrec :: Int -> ReadS GetApprovalRuleTemplate
Prelude.Read, Int -> GetApprovalRuleTemplate -> ShowS
[GetApprovalRuleTemplate] -> ShowS
GetApprovalRuleTemplate -> String
(Int -> GetApprovalRuleTemplate -> ShowS)
-> (GetApprovalRuleTemplate -> String)
-> ([GetApprovalRuleTemplate] -> ShowS)
-> Show GetApprovalRuleTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApprovalRuleTemplate] -> ShowS
$cshowList :: [GetApprovalRuleTemplate] -> ShowS
show :: GetApprovalRuleTemplate -> String
$cshow :: GetApprovalRuleTemplate -> String
showsPrec :: Int -> GetApprovalRuleTemplate -> ShowS
$cshowsPrec :: Int -> GetApprovalRuleTemplate -> ShowS
Prelude.Show, (forall x.
GetApprovalRuleTemplate -> Rep GetApprovalRuleTemplate x)
-> (forall x.
Rep GetApprovalRuleTemplate x -> GetApprovalRuleTemplate)
-> Generic GetApprovalRuleTemplate
forall x. Rep GetApprovalRuleTemplate x -> GetApprovalRuleTemplate
forall x. GetApprovalRuleTemplate -> Rep GetApprovalRuleTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApprovalRuleTemplate x -> GetApprovalRuleTemplate
$cfrom :: forall x. GetApprovalRuleTemplate -> Rep GetApprovalRuleTemplate x
Prelude.Generic)
newGetApprovalRuleTemplate ::
Prelude.Text ->
GetApprovalRuleTemplate
newGetApprovalRuleTemplate :: Text -> GetApprovalRuleTemplate
newGetApprovalRuleTemplate Text
pApprovalRuleTemplateName_ =
GetApprovalRuleTemplate' :: Text -> GetApprovalRuleTemplate
GetApprovalRuleTemplate'
{ $sel:approvalRuleTemplateName:GetApprovalRuleTemplate' :: Text
approvalRuleTemplateName =
Text
pApprovalRuleTemplateName_
}
getApprovalRuleTemplate_approvalRuleTemplateName :: Lens.Lens' GetApprovalRuleTemplate Prelude.Text
getApprovalRuleTemplate_approvalRuleTemplateName :: (Text -> f Text)
-> GetApprovalRuleTemplate -> f GetApprovalRuleTemplate
getApprovalRuleTemplate_approvalRuleTemplateName = (GetApprovalRuleTemplate -> Text)
-> (GetApprovalRuleTemplate -> Text -> GetApprovalRuleTemplate)
-> Lens GetApprovalRuleTemplate GetApprovalRuleTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApprovalRuleTemplate' {Text
approvalRuleTemplateName :: Text
$sel:approvalRuleTemplateName:GetApprovalRuleTemplate' :: GetApprovalRuleTemplate -> Text
approvalRuleTemplateName} -> Text
approvalRuleTemplateName) (\s :: GetApprovalRuleTemplate
s@GetApprovalRuleTemplate' {} Text
a -> GetApprovalRuleTemplate
s {$sel:approvalRuleTemplateName:GetApprovalRuleTemplate' :: Text
approvalRuleTemplateName = Text
a} :: GetApprovalRuleTemplate)
instance Core.AWSRequest GetApprovalRuleTemplate where
type
AWSResponse GetApprovalRuleTemplate =
GetApprovalRuleTemplateResponse
request :: GetApprovalRuleTemplate -> Request GetApprovalRuleTemplate
request = Service
-> GetApprovalRuleTemplate -> Request GetApprovalRuleTemplate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetApprovalRuleTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetApprovalRuleTemplate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetApprovalRuleTemplate))
-> Logger
-> Service
-> Proxy GetApprovalRuleTemplate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetApprovalRuleTemplate)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> ApprovalRuleTemplate -> GetApprovalRuleTemplateResponse
GetApprovalRuleTemplateResponse'
(Int -> ApprovalRuleTemplate -> GetApprovalRuleTemplateResponse)
-> Either String Int
-> Either
String (ApprovalRuleTemplate -> GetApprovalRuleTemplateResponse)
forall (f :: * -> *) a b. Functor 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))
Either
String (ApprovalRuleTemplate -> GetApprovalRuleTemplateResponse)
-> Either String ApprovalRuleTemplate
-> Either String GetApprovalRuleTemplateResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ApprovalRuleTemplate
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"approvalRuleTemplate")
)
instance Prelude.Hashable GetApprovalRuleTemplate
instance Prelude.NFData GetApprovalRuleTemplate
instance Core.ToHeaders GetApprovalRuleTemplate where
toHeaders :: GetApprovalRuleTemplate -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetApprovalRuleTemplate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodeCommit_20150413.GetApprovalRuleTemplate" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetApprovalRuleTemplate where
toJSON :: GetApprovalRuleTemplate -> Value
toJSON GetApprovalRuleTemplate' {Text
approvalRuleTemplateName :: Text
$sel:approvalRuleTemplateName:GetApprovalRuleTemplate' :: GetApprovalRuleTemplate -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"approvalRuleTemplateName"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
approvalRuleTemplateName
)
]
)
instance Core.ToPath GetApprovalRuleTemplate where
toPath :: GetApprovalRuleTemplate -> ByteString
toPath = ByteString -> GetApprovalRuleTemplate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetApprovalRuleTemplate where
toQuery :: GetApprovalRuleTemplate -> QueryString
toQuery = QueryString -> GetApprovalRuleTemplate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetApprovalRuleTemplateResponse = GetApprovalRuleTemplateResponse'
{
GetApprovalRuleTemplateResponse -> Int
httpStatus :: Prelude.Int,
GetApprovalRuleTemplateResponse -> ApprovalRuleTemplate
approvalRuleTemplate :: ApprovalRuleTemplate
}
deriving (GetApprovalRuleTemplateResponse
-> GetApprovalRuleTemplateResponse -> Bool
(GetApprovalRuleTemplateResponse
-> GetApprovalRuleTemplateResponse -> Bool)
-> (GetApprovalRuleTemplateResponse
-> GetApprovalRuleTemplateResponse -> Bool)
-> Eq GetApprovalRuleTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApprovalRuleTemplateResponse
-> GetApprovalRuleTemplateResponse -> Bool
$c/= :: GetApprovalRuleTemplateResponse
-> GetApprovalRuleTemplateResponse -> Bool
== :: GetApprovalRuleTemplateResponse
-> GetApprovalRuleTemplateResponse -> Bool
$c== :: GetApprovalRuleTemplateResponse
-> GetApprovalRuleTemplateResponse -> Bool
Prelude.Eq, ReadPrec [GetApprovalRuleTemplateResponse]
ReadPrec GetApprovalRuleTemplateResponse
Int -> ReadS GetApprovalRuleTemplateResponse
ReadS [GetApprovalRuleTemplateResponse]
(Int -> ReadS GetApprovalRuleTemplateResponse)
-> ReadS [GetApprovalRuleTemplateResponse]
-> ReadPrec GetApprovalRuleTemplateResponse
-> ReadPrec [GetApprovalRuleTemplateResponse]
-> Read GetApprovalRuleTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApprovalRuleTemplateResponse]
$creadListPrec :: ReadPrec [GetApprovalRuleTemplateResponse]
readPrec :: ReadPrec GetApprovalRuleTemplateResponse
$creadPrec :: ReadPrec GetApprovalRuleTemplateResponse
readList :: ReadS [GetApprovalRuleTemplateResponse]
$creadList :: ReadS [GetApprovalRuleTemplateResponse]
readsPrec :: Int -> ReadS GetApprovalRuleTemplateResponse
$creadsPrec :: Int -> ReadS GetApprovalRuleTemplateResponse
Prelude.Read, Int -> GetApprovalRuleTemplateResponse -> ShowS
[GetApprovalRuleTemplateResponse] -> ShowS
GetApprovalRuleTemplateResponse -> String
(Int -> GetApprovalRuleTemplateResponse -> ShowS)
-> (GetApprovalRuleTemplateResponse -> String)
-> ([GetApprovalRuleTemplateResponse] -> ShowS)
-> Show GetApprovalRuleTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApprovalRuleTemplateResponse] -> ShowS
$cshowList :: [GetApprovalRuleTemplateResponse] -> ShowS
show :: GetApprovalRuleTemplateResponse -> String
$cshow :: GetApprovalRuleTemplateResponse -> String
showsPrec :: Int -> GetApprovalRuleTemplateResponse -> ShowS
$cshowsPrec :: Int -> GetApprovalRuleTemplateResponse -> ShowS
Prelude.Show, (forall x.
GetApprovalRuleTemplateResponse
-> Rep GetApprovalRuleTemplateResponse x)
-> (forall x.
Rep GetApprovalRuleTemplateResponse x
-> GetApprovalRuleTemplateResponse)
-> Generic GetApprovalRuleTemplateResponse
forall x.
Rep GetApprovalRuleTemplateResponse x
-> GetApprovalRuleTemplateResponse
forall x.
GetApprovalRuleTemplateResponse
-> Rep GetApprovalRuleTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetApprovalRuleTemplateResponse x
-> GetApprovalRuleTemplateResponse
$cfrom :: forall x.
GetApprovalRuleTemplateResponse
-> Rep GetApprovalRuleTemplateResponse x
Prelude.Generic)
newGetApprovalRuleTemplateResponse ::
Prelude.Int ->
ApprovalRuleTemplate ->
GetApprovalRuleTemplateResponse
newGetApprovalRuleTemplateResponse :: Int -> ApprovalRuleTemplate -> GetApprovalRuleTemplateResponse
newGetApprovalRuleTemplateResponse
Int
pHttpStatus_
ApprovalRuleTemplate
pApprovalRuleTemplate_ =
GetApprovalRuleTemplateResponse' :: Int -> ApprovalRuleTemplate -> GetApprovalRuleTemplateResponse
GetApprovalRuleTemplateResponse'
{ $sel:httpStatus:GetApprovalRuleTemplateResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:approvalRuleTemplate:GetApprovalRuleTemplateResponse' :: ApprovalRuleTemplate
approvalRuleTemplate =
ApprovalRuleTemplate
pApprovalRuleTemplate_
}
getApprovalRuleTemplateResponse_httpStatus :: Lens.Lens' GetApprovalRuleTemplateResponse Prelude.Int
getApprovalRuleTemplateResponse_httpStatus :: (Int -> f Int)
-> GetApprovalRuleTemplateResponse
-> f GetApprovalRuleTemplateResponse
getApprovalRuleTemplateResponse_httpStatus = (GetApprovalRuleTemplateResponse -> Int)
-> (GetApprovalRuleTemplateResponse
-> Int -> GetApprovalRuleTemplateResponse)
-> Lens
GetApprovalRuleTemplateResponse
GetApprovalRuleTemplateResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApprovalRuleTemplateResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetApprovalRuleTemplateResponse' :: GetApprovalRuleTemplateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetApprovalRuleTemplateResponse
s@GetApprovalRuleTemplateResponse' {} Int
a -> GetApprovalRuleTemplateResponse
s {$sel:httpStatus:GetApprovalRuleTemplateResponse' :: Int
httpStatus = Int
a} :: GetApprovalRuleTemplateResponse)
getApprovalRuleTemplateResponse_approvalRuleTemplate :: Lens.Lens' GetApprovalRuleTemplateResponse ApprovalRuleTemplate
getApprovalRuleTemplateResponse_approvalRuleTemplate :: (ApprovalRuleTemplate -> f ApprovalRuleTemplate)
-> GetApprovalRuleTemplateResponse
-> f GetApprovalRuleTemplateResponse
getApprovalRuleTemplateResponse_approvalRuleTemplate = (GetApprovalRuleTemplateResponse -> ApprovalRuleTemplate)
-> (GetApprovalRuleTemplateResponse
-> ApprovalRuleTemplate -> GetApprovalRuleTemplateResponse)
-> Lens
GetApprovalRuleTemplateResponse
GetApprovalRuleTemplateResponse
ApprovalRuleTemplate
ApprovalRuleTemplate
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApprovalRuleTemplateResponse' {ApprovalRuleTemplate
approvalRuleTemplate :: ApprovalRuleTemplate
$sel:approvalRuleTemplate:GetApprovalRuleTemplateResponse' :: GetApprovalRuleTemplateResponse -> ApprovalRuleTemplate
approvalRuleTemplate} -> ApprovalRuleTemplate
approvalRuleTemplate) (\s :: GetApprovalRuleTemplateResponse
s@GetApprovalRuleTemplateResponse' {} ApprovalRuleTemplate
a -> GetApprovalRuleTemplateResponse
s {$sel:approvalRuleTemplate:GetApprovalRuleTemplateResponse' :: ApprovalRuleTemplate
approvalRuleTemplate = ApprovalRuleTemplate
a} :: GetApprovalRuleTemplateResponse)
instance
Prelude.NFData
GetApprovalRuleTemplateResponse