{-# 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.AuditManager.GetControl
(
GetControl (..),
newGetControl,
getControl_controlId,
GetControlResponse (..),
newGetControlResponse,
getControlResponse_control,
getControlResponse_httpStatus,
)
where
import Amazonka.AuditManager.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 GetControl = GetControl'
{
GetControl -> Text
controlId :: Prelude.Text
}
deriving (GetControl -> GetControl -> Bool
(GetControl -> GetControl -> Bool)
-> (GetControl -> GetControl -> Bool) -> Eq GetControl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetControl -> GetControl -> Bool
$c/= :: GetControl -> GetControl -> Bool
== :: GetControl -> GetControl -> Bool
$c== :: GetControl -> GetControl -> Bool
Prelude.Eq, ReadPrec [GetControl]
ReadPrec GetControl
Int -> ReadS GetControl
ReadS [GetControl]
(Int -> ReadS GetControl)
-> ReadS [GetControl]
-> ReadPrec GetControl
-> ReadPrec [GetControl]
-> Read GetControl
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetControl]
$creadListPrec :: ReadPrec [GetControl]
readPrec :: ReadPrec GetControl
$creadPrec :: ReadPrec GetControl
readList :: ReadS [GetControl]
$creadList :: ReadS [GetControl]
readsPrec :: Int -> ReadS GetControl
$creadsPrec :: Int -> ReadS GetControl
Prelude.Read, Int -> GetControl -> ShowS
[GetControl] -> ShowS
GetControl -> String
(Int -> GetControl -> ShowS)
-> (GetControl -> String)
-> ([GetControl] -> ShowS)
-> Show GetControl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetControl] -> ShowS
$cshowList :: [GetControl] -> ShowS
show :: GetControl -> String
$cshow :: GetControl -> String
showsPrec :: Int -> GetControl -> ShowS
$cshowsPrec :: Int -> GetControl -> ShowS
Prelude.Show, (forall x. GetControl -> Rep GetControl x)
-> (forall x. Rep GetControl x -> GetControl) -> Generic GetControl
forall x. Rep GetControl x -> GetControl
forall x. GetControl -> Rep GetControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetControl x -> GetControl
$cfrom :: forall x. GetControl -> Rep GetControl x
Prelude.Generic)
newGetControl ::
Prelude.Text ->
GetControl
newGetControl :: Text -> GetControl
newGetControl Text
pControlId_ =
GetControl' :: Text -> GetControl
GetControl' {$sel:controlId:GetControl' :: Text
controlId = Text
pControlId_}
getControl_controlId :: Lens.Lens' GetControl Prelude.Text
getControl_controlId :: (Text -> f Text) -> GetControl -> f GetControl
getControl_controlId = (GetControl -> Text)
-> (GetControl -> Text -> GetControl)
-> Lens GetControl GetControl Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetControl' {Text
controlId :: Text
$sel:controlId:GetControl' :: GetControl -> Text
controlId} -> Text
controlId) (\s :: GetControl
s@GetControl' {} Text
a -> GetControl
s {$sel:controlId:GetControl' :: Text
controlId = Text
a} :: GetControl)
instance Core.AWSRequest GetControl where
type AWSResponse GetControl = GetControlResponse
request :: GetControl -> Request GetControl
request = Service -> GetControl -> Request GetControl
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetControl
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetControl)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetControl))
-> Logger
-> Service
-> Proxy GetControl
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetControl)))
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 ->
Maybe Control -> Int -> GetControlResponse
GetControlResponse'
(Maybe Control -> Int -> GetControlResponse)
-> Either String (Maybe Control)
-> Either String (Int -> GetControlResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Control)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"control")
Either String (Int -> GetControlResponse)
-> Either String Int -> Either String GetControlResponse
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 GetControl
instance Prelude.NFData GetControl
instance Core.ToHeaders GetControl where
toHeaders :: GetControl -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetControl -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath GetControl where
toPath :: GetControl -> ByteString
toPath GetControl' {Text
controlId :: Text
$sel:controlId:GetControl' :: GetControl -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/controls/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
controlId]
instance Core.ToQuery GetControl where
toQuery :: GetControl -> QueryString
toQuery = QueryString -> GetControl -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetControlResponse = GetControlResponse'
{
GetControlResponse -> Maybe Control
control :: Prelude.Maybe Control,
GetControlResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetControlResponse -> GetControlResponse -> Bool
(GetControlResponse -> GetControlResponse -> Bool)
-> (GetControlResponse -> GetControlResponse -> Bool)
-> Eq GetControlResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetControlResponse -> GetControlResponse -> Bool
$c/= :: GetControlResponse -> GetControlResponse -> Bool
== :: GetControlResponse -> GetControlResponse -> Bool
$c== :: GetControlResponse -> GetControlResponse -> Bool
Prelude.Eq, ReadPrec [GetControlResponse]
ReadPrec GetControlResponse
Int -> ReadS GetControlResponse
ReadS [GetControlResponse]
(Int -> ReadS GetControlResponse)
-> ReadS [GetControlResponse]
-> ReadPrec GetControlResponse
-> ReadPrec [GetControlResponse]
-> Read GetControlResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetControlResponse]
$creadListPrec :: ReadPrec [GetControlResponse]
readPrec :: ReadPrec GetControlResponse
$creadPrec :: ReadPrec GetControlResponse
readList :: ReadS [GetControlResponse]
$creadList :: ReadS [GetControlResponse]
readsPrec :: Int -> ReadS GetControlResponse
$creadsPrec :: Int -> ReadS GetControlResponse
Prelude.Read, Int -> GetControlResponse -> ShowS
[GetControlResponse] -> ShowS
GetControlResponse -> String
(Int -> GetControlResponse -> ShowS)
-> (GetControlResponse -> String)
-> ([GetControlResponse] -> ShowS)
-> Show GetControlResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetControlResponse] -> ShowS
$cshowList :: [GetControlResponse] -> ShowS
show :: GetControlResponse -> String
$cshow :: GetControlResponse -> String
showsPrec :: Int -> GetControlResponse -> ShowS
$cshowsPrec :: Int -> GetControlResponse -> ShowS
Prelude.Show, (forall x. GetControlResponse -> Rep GetControlResponse x)
-> (forall x. Rep GetControlResponse x -> GetControlResponse)
-> Generic GetControlResponse
forall x. Rep GetControlResponse x -> GetControlResponse
forall x. GetControlResponse -> Rep GetControlResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetControlResponse x -> GetControlResponse
$cfrom :: forall x. GetControlResponse -> Rep GetControlResponse x
Prelude.Generic)
newGetControlResponse ::
Prelude.Int ->
GetControlResponse
newGetControlResponse :: Int -> GetControlResponse
newGetControlResponse Int
pHttpStatus_ =
GetControlResponse' :: Maybe Control -> Int -> GetControlResponse
GetControlResponse'
{ $sel:control:GetControlResponse' :: Maybe Control
control = Maybe Control
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetControlResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getControlResponse_control :: Lens.Lens' GetControlResponse (Prelude.Maybe Control)
getControlResponse_control :: (Maybe Control -> f (Maybe Control))
-> GetControlResponse -> f GetControlResponse
getControlResponse_control = (GetControlResponse -> Maybe Control)
-> (GetControlResponse -> Maybe Control -> GetControlResponse)
-> Lens
GetControlResponse
GetControlResponse
(Maybe Control)
(Maybe Control)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetControlResponse' {Maybe Control
control :: Maybe Control
$sel:control:GetControlResponse' :: GetControlResponse -> Maybe Control
control} -> Maybe Control
control) (\s :: GetControlResponse
s@GetControlResponse' {} Maybe Control
a -> GetControlResponse
s {$sel:control:GetControlResponse' :: Maybe Control
control = Maybe Control
a} :: GetControlResponse)
getControlResponse_httpStatus :: Lens.Lens' GetControlResponse Prelude.Int
getControlResponse_httpStatus :: (Int -> f Int) -> GetControlResponse -> f GetControlResponse
getControlResponse_httpStatus = (GetControlResponse -> Int)
-> (GetControlResponse -> Int -> GetControlResponse)
-> Lens GetControlResponse GetControlResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetControlResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetControlResponse' :: GetControlResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetControlResponse
s@GetControlResponse' {} Int
a -> GetControlResponse
s {$sel:httpStatus:GetControlResponse' :: Int
httpStatus = Int
a} :: GetControlResponse)
instance Prelude.NFData GetControlResponse