{-# 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.ControlTower.GetControlOperation
(
GetControlOperation (..),
newGetControlOperation,
getControlOperation_operationIdentifier,
GetControlOperationResponse (..),
newGetControlOperationResponse,
getControlOperationResponse_httpStatus,
getControlOperationResponse_controlOperation,
)
where
import Amazonka.ControlTower.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetControlOperation = GetControlOperation'
{
GetControlOperation -> Text
operationIdentifier :: Prelude.Text
}
deriving (GetControlOperation -> GetControlOperation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetControlOperation -> GetControlOperation -> Bool
$c/= :: GetControlOperation -> GetControlOperation -> Bool
== :: GetControlOperation -> GetControlOperation -> Bool
$c== :: GetControlOperation -> GetControlOperation -> Bool
Prelude.Eq, ReadPrec [GetControlOperation]
ReadPrec GetControlOperation
Int -> ReadS GetControlOperation
ReadS [GetControlOperation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetControlOperation]
$creadListPrec :: ReadPrec [GetControlOperation]
readPrec :: ReadPrec GetControlOperation
$creadPrec :: ReadPrec GetControlOperation
readList :: ReadS [GetControlOperation]
$creadList :: ReadS [GetControlOperation]
readsPrec :: Int -> ReadS GetControlOperation
$creadsPrec :: Int -> ReadS GetControlOperation
Prelude.Read, Int -> GetControlOperation -> ShowS
[GetControlOperation] -> ShowS
GetControlOperation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetControlOperation] -> ShowS
$cshowList :: [GetControlOperation] -> ShowS
show :: GetControlOperation -> String
$cshow :: GetControlOperation -> String
showsPrec :: Int -> GetControlOperation -> ShowS
$cshowsPrec :: Int -> GetControlOperation -> ShowS
Prelude.Show, forall x. Rep GetControlOperation x -> GetControlOperation
forall x. GetControlOperation -> Rep GetControlOperation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetControlOperation x -> GetControlOperation
$cfrom :: forall x. GetControlOperation -> Rep GetControlOperation x
Prelude.Generic)
newGetControlOperation ::
Prelude.Text ->
GetControlOperation
newGetControlOperation :: Text -> GetControlOperation
newGetControlOperation Text
pOperationIdentifier_ =
GetControlOperation'
{ $sel:operationIdentifier:GetControlOperation' :: Text
operationIdentifier =
Text
pOperationIdentifier_
}
getControlOperation_operationIdentifier :: Lens.Lens' GetControlOperation Prelude.Text
getControlOperation_operationIdentifier :: Lens' GetControlOperation Text
getControlOperation_operationIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetControlOperation' {Text
operationIdentifier :: Text
$sel:operationIdentifier:GetControlOperation' :: GetControlOperation -> Text
operationIdentifier} -> Text
operationIdentifier) (\s :: GetControlOperation
s@GetControlOperation' {} Text
a -> GetControlOperation
s {$sel:operationIdentifier:GetControlOperation' :: Text
operationIdentifier = Text
a} :: GetControlOperation)
instance Core.AWSRequest GetControlOperation where
type
AWSResponse GetControlOperation =
GetControlOperationResponse
request :: (Service -> Service)
-> GetControlOperation -> Request GetControlOperation
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetControlOperation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetControlOperation)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> ControlOperation -> GetControlOperationResponse
GetControlOperationResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"controlOperation")
)
instance Prelude.Hashable GetControlOperation where
hashWithSalt :: Int -> GetControlOperation -> Int
hashWithSalt Int
_salt GetControlOperation' {Text
operationIdentifier :: Text
$sel:operationIdentifier:GetControlOperation' :: GetControlOperation -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
operationIdentifier
instance Prelude.NFData GetControlOperation where
rnf :: GetControlOperation -> ()
rnf GetControlOperation' {Text
operationIdentifier :: Text
$sel:operationIdentifier:GetControlOperation' :: GetControlOperation -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
operationIdentifier
instance Data.ToHeaders GetControlOperation where
toHeaders :: GetControlOperation -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetControlOperation where
toJSON :: GetControlOperation -> Value
toJSON GetControlOperation' {Text
operationIdentifier :: Text
$sel:operationIdentifier:GetControlOperation' :: GetControlOperation -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"operationIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
operationIdentifier)
]
)
instance Data.ToPath GetControlOperation where
toPath :: GetControlOperation -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/get-control-operation"
instance Data.ToQuery GetControlOperation where
toQuery :: GetControlOperation -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetControlOperationResponse = GetControlOperationResponse'
{
GetControlOperationResponse -> Int
httpStatus :: Prelude.Int,
GetControlOperationResponse -> ControlOperation
controlOperation :: ControlOperation
}
deriving (GetControlOperationResponse -> GetControlOperationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetControlOperationResponse -> GetControlOperationResponse -> Bool
$c/= :: GetControlOperationResponse -> GetControlOperationResponse -> Bool
== :: GetControlOperationResponse -> GetControlOperationResponse -> Bool
$c== :: GetControlOperationResponse -> GetControlOperationResponse -> Bool
Prelude.Eq, ReadPrec [GetControlOperationResponse]
ReadPrec GetControlOperationResponse
Int -> ReadS GetControlOperationResponse
ReadS [GetControlOperationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetControlOperationResponse]
$creadListPrec :: ReadPrec [GetControlOperationResponse]
readPrec :: ReadPrec GetControlOperationResponse
$creadPrec :: ReadPrec GetControlOperationResponse
readList :: ReadS [GetControlOperationResponse]
$creadList :: ReadS [GetControlOperationResponse]
readsPrec :: Int -> ReadS GetControlOperationResponse
$creadsPrec :: Int -> ReadS GetControlOperationResponse
Prelude.Read, Int -> GetControlOperationResponse -> ShowS
[GetControlOperationResponse] -> ShowS
GetControlOperationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetControlOperationResponse] -> ShowS
$cshowList :: [GetControlOperationResponse] -> ShowS
show :: GetControlOperationResponse -> String
$cshow :: GetControlOperationResponse -> String
showsPrec :: Int -> GetControlOperationResponse -> ShowS
$cshowsPrec :: Int -> GetControlOperationResponse -> ShowS
Prelude.Show, forall x.
Rep GetControlOperationResponse x -> GetControlOperationResponse
forall x.
GetControlOperationResponse -> Rep GetControlOperationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetControlOperationResponse x -> GetControlOperationResponse
$cfrom :: forall x.
GetControlOperationResponse -> Rep GetControlOperationResponse x
Prelude.Generic)
newGetControlOperationResponse ::
Prelude.Int ->
ControlOperation ->
GetControlOperationResponse
newGetControlOperationResponse :: Int -> ControlOperation -> GetControlOperationResponse
newGetControlOperationResponse
Int
pHttpStatus_
ControlOperation
pControlOperation_ =
GetControlOperationResponse'
{ $sel:httpStatus:GetControlOperationResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:controlOperation:GetControlOperationResponse' :: ControlOperation
controlOperation = ControlOperation
pControlOperation_
}
getControlOperationResponse_httpStatus :: Lens.Lens' GetControlOperationResponse Prelude.Int
getControlOperationResponse_httpStatus :: Lens' GetControlOperationResponse Int
getControlOperationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetControlOperationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetControlOperationResponse' :: GetControlOperationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetControlOperationResponse
s@GetControlOperationResponse' {} Int
a -> GetControlOperationResponse
s {$sel:httpStatus:GetControlOperationResponse' :: Int
httpStatus = Int
a} :: GetControlOperationResponse)
getControlOperationResponse_controlOperation :: Lens.Lens' GetControlOperationResponse ControlOperation
getControlOperationResponse_controlOperation :: Lens' GetControlOperationResponse ControlOperation
getControlOperationResponse_controlOperation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetControlOperationResponse' {ControlOperation
controlOperation :: ControlOperation
$sel:controlOperation:GetControlOperationResponse' :: GetControlOperationResponse -> ControlOperation
controlOperation} -> ControlOperation
controlOperation) (\s :: GetControlOperationResponse
s@GetControlOperationResponse' {} ControlOperation
a -> GetControlOperationResponse
s {$sel:controlOperation:GetControlOperationResponse' :: ControlOperation
controlOperation = ControlOperation
a} :: GetControlOperationResponse)
instance Prelude.NFData GetControlOperationResponse where
rnf :: GetControlOperationResponse -> ()
rnf GetControlOperationResponse' {Int
ControlOperation
controlOperation :: ControlOperation
httpStatus :: Int
$sel:controlOperation:GetControlOperationResponse' :: GetControlOperationResponse -> ControlOperation
$sel:httpStatus:GetControlOperationResponse' :: GetControlOperationResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ControlOperation
controlOperation