{-# 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.DisableControl
(
DisableControl (..),
newDisableControl,
disableControl_controlIdentifier,
disableControl_targetIdentifier,
DisableControlResponse (..),
newDisableControlResponse,
disableControlResponse_httpStatus,
disableControlResponse_operationIdentifier,
)
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 DisableControl = DisableControl'
{
DisableControl -> Text
controlIdentifier :: Prelude.Text,
DisableControl -> Text
targetIdentifier :: Prelude.Text
}
deriving (DisableControl -> DisableControl -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableControl -> DisableControl -> Bool
$c/= :: DisableControl -> DisableControl -> Bool
== :: DisableControl -> DisableControl -> Bool
$c== :: DisableControl -> DisableControl -> Bool
Prelude.Eq, ReadPrec [DisableControl]
ReadPrec DisableControl
Int -> ReadS DisableControl
ReadS [DisableControl]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableControl]
$creadListPrec :: ReadPrec [DisableControl]
readPrec :: ReadPrec DisableControl
$creadPrec :: ReadPrec DisableControl
readList :: ReadS [DisableControl]
$creadList :: ReadS [DisableControl]
readsPrec :: Int -> ReadS DisableControl
$creadsPrec :: Int -> ReadS DisableControl
Prelude.Read, Int -> DisableControl -> ShowS
[DisableControl] -> ShowS
DisableControl -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableControl] -> ShowS
$cshowList :: [DisableControl] -> ShowS
show :: DisableControl -> String
$cshow :: DisableControl -> String
showsPrec :: Int -> DisableControl -> ShowS
$cshowsPrec :: Int -> DisableControl -> ShowS
Prelude.Show, forall x. Rep DisableControl x -> DisableControl
forall x. DisableControl -> Rep DisableControl x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisableControl x -> DisableControl
$cfrom :: forall x. DisableControl -> Rep DisableControl x
Prelude.Generic)
newDisableControl ::
Prelude.Text ->
Prelude.Text ->
DisableControl
newDisableControl :: Text -> Text -> DisableControl
newDisableControl
Text
pControlIdentifier_
Text
pTargetIdentifier_ =
DisableControl'
{ $sel:controlIdentifier:DisableControl' :: Text
controlIdentifier =
Text
pControlIdentifier_,
$sel:targetIdentifier:DisableControl' :: Text
targetIdentifier = Text
pTargetIdentifier_
}
disableControl_controlIdentifier :: Lens.Lens' DisableControl Prelude.Text
disableControl_controlIdentifier :: Lens' DisableControl Text
disableControl_controlIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableControl' {Text
controlIdentifier :: Text
$sel:controlIdentifier:DisableControl' :: DisableControl -> Text
controlIdentifier} -> Text
controlIdentifier) (\s :: DisableControl
s@DisableControl' {} Text
a -> DisableControl
s {$sel:controlIdentifier:DisableControl' :: Text
controlIdentifier = Text
a} :: DisableControl)
disableControl_targetIdentifier :: Lens.Lens' DisableControl Prelude.Text
disableControl_targetIdentifier :: Lens' DisableControl Text
disableControl_targetIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableControl' {Text
targetIdentifier :: Text
$sel:targetIdentifier:DisableControl' :: DisableControl -> Text
targetIdentifier} -> Text
targetIdentifier) (\s :: DisableControl
s@DisableControl' {} Text
a -> DisableControl
s {$sel:targetIdentifier:DisableControl' :: Text
targetIdentifier = Text
a} :: DisableControl)
instance Core.AWSRequest DisableControl where
type
AWSResponse DisableControl =
DisableControlResponse
request :: (Service -> Service) -> DisableControl -> Request DisableControl
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 DisableControl
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DisableControl)))
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 -> Text -> DisableControlResponse
DisableControlResponse'
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
"operationIdentifier")
)
instance Prelude.Hashable DisableControl where
hashWithSalt :: Int -> DisableControl -> Int
hashWithSalt Int
_salt DisableControl' {Text
targetIdentifier :: Text
controlIdentifier :: Text
$sel:targetIdentifier:DisableControl' :: DisableControl -> Text
$sel:controlIdentifier:DisableControl' :: DisableControl -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
controlIdentifier
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetIdentifier
instance Prelude.NFData DisableControl where
rnf :: DisableControl -> ()
rnf DisableControl' {Text
targetIdentifier :: Text
controlIdentifier :: Text
$sel:targetIdentifier:DisableControl' :: DisableControl -> Text
$sel:controlIdentifier:DisableControl' :: DisableControl -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
controlIdentifier
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
targetIdentifier
instance Data.ToHeaders DisableControl where
toHeaders :: DisableControl -> 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 DisableControl where
toJSON :: DisableControl -> Value
toJSON DisableControl' {Text
targetIdentifier :: Text
controlIdentifier :: Text
$sel:targetIdentifier:DisableControl' :: DisableControl -> Text
$sel:controlIdentifier:DisableControl' :: DisableControl -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"controlIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
controlIdentifier),
forall a. a -> Maybe a
Prelude.Just
(Key
"targetIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
targetIdentifier)
]
)
instance Data.ToPath DisableControl where
toPath :: DisableControl -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/disable-control"
instance Data.ToQuery DisableControl where
toQuery :: DisableControl -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DisableControlResponse = DisableControlResponse'
{
DisableControlResponse -> Int
httpStatus :: Prelude.Int,
DisableControlResponse -> Text
operationIdentifier :: Prelude.Text
}
deriving (DisableControlResponse -> DisableControlResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableControlResponse -> DisableControlResponse -> Bool
$c/= :: DisableControlResponse -> DisableControlResponse -> Bool
== :: DisableControlResponse -> DisableControlResponse -> Bool
$c== :: DisableControlResponse -> DisableControlResponse -> Bool
Prelude.Eq, ReadPrec [DisableControlResponse]
ReadPrec DisableControlResponse
Int -> ReadS DisableControlResponse
ReadS [DisableControlResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableControlResponse]
$creadListPrec :: ReadPrec [DisableControlResponse]
readPrec :: ReadPrec DisableControlResponse
$creadPrec :: ReadPrec DisableControlResponse
readList :: ReadS [DisableControlResponse]
$creadList :: ReadS [DisableControlResponse]
readsPrec :: Int -> ReadS DisableControlResponse
$creadsPrec :: Int -> ReadS DisableControlResponse
Prelude.Read, Int -> DisableControlResponse -> ShowS
[DisableControlResponse] -> ShowS
DisableControlResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableControlResponse] -> ShowS
$cshowList :: [DisableControlResponse] -> ShowS
show :: DisableControlResponse -> String
$cshow :: DisableControlResponse -> String
showsPrec :: Int -> DisableControlResponse -> ShowS
$cshowsPrec :: Int -> DisableControlResponse -> ShowS
Prelude.Show, forall x. Rep DisableControlResponse x -> DisableControlResponse
forall x. DisableControlResponse -> Rep DisableControlResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisableControlResponse x -> DisableControlResponse
$cfrom :: forall x. DisableControlResponse -> Rep DisableControlResponse x
Prelude.Generic)
newDisableControlResponse ::
Prelude.Int ->
Prelude.Text ->
DisableControlResponse
newDisableControlResponse :: Int -> Text -> DisableControlResponse
newDisableControlResponse
Int
pHttpStatus_
Text
pOperationIdentifier_ =
DisableControlResponse'
{ $sel:httpStatus:DisableControlResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:operationIdentifier:DisableControlResponse' :: Text
operationIdentifier = Text
pOperationIdentifier_
}
disableControlResponse_httpStatus :: Lens.Lens' DisableControlResponse Prelude.Int
disableControlResponse_httpStatus :: Lens' DisableControlResponse Int
disableControlResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableControlResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisableControlResponse' :: DisableControlResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DisableControlResponse
s@DisableControlResponse' {} Int
a -> DisableControlResponse
s {$sel:httpStatus:DisableControlResponse' :: Int
httpStatus = Int
a} :: DisableControlResponse)
disableControlResponse_operationIdentifier :: Lens.Lens' DisableControlResponse Prelude.Text
disableControlResponse_operationIdentifier :: Lens' DisableControlResponse Text
disableControlResponse_operationIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableControlResponse' {Text
operationIdentifier :: Text
$sel:operationIdentifier:DisableControlResponse' :: DisableControlResponse -> Text
operationIdentifier} -> Text
operationIdentifier) (\s :: DisableControlResponse
s@DisableControlResponse' {} Text
a -> DisableControlResponse
s {$sel:operationIdentifier:DisableControlResponse' :: Text
operationIdentifier = Text
a} :: DisableControlResponse)
instance Prelude.NFData DisableControlResponse where
rnf :: DisableControlResponse -> ()
rnf DisableControlResponse' {Int
Text
operationIdentifier :: Text
httpStatus :: Int
$sel:operationIdentifier:DisableControlResponse' :: DisableControlResponse -> Text
$sel:httpStatus:DisableControlResponse' :: DisableControlResponse -> 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 Text
operationIdentifier