{-# 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.FraudDetector.PutDetector
(
PutDetector (..),
newPutDetector,
putDetector_description,
putDetector_tags,
putDetector_detectorId,
putDetector_eventTypeName,
PutDetectorResponse (..),
newPutDetectorResponse,
putDetectorResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.Types
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 PutDetector = PutDetector'
{
PutDetector -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
PutDetector -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
PutDetector -> Text
detectorId :: Prelude.Text,
PutDetector -> Text
eventTypeName :: Prelude.Text
}
deriving (PutDetector -> PutDetector -> Bool
(PutDetector -> PutDetector -> Bool)
-> (PutDetector -> PutDetector -> Bool) -> Eq PutDetector
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDetector -> PutDetector -> Bool
$c/= :: PutDetector -> PutDetector -> Bool
== :: PutDetector -> PutDetector -> Bool
$c== :: PutDetector -> PutDetector -> Bool
Prelude.Eq, ReadPrec [PutDetector]
ReadPrec PutDetector
Int -> ReadS PutDetector
ReadS [PutDetector]
(Int -> ReadS PutDetector)
-> ReadS [PutDetector]
-> ReadPrec PutDetector
-> ReadPrec [PutDetector]
-> Read PutDetector
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDetector]
$creadListPrec :: ReadPrec [PutDetector]
readPrec :: ReadPrec PutDetector
$creadPrec :: ReadPrec PutDetector
readList :: ReadS [PutDetector]
$creadList :: ReadS [PutDetector]
readsPrec :: Int -> ReadS PutDetector
$creadsPrec :: Int -> ReadS PutDetector
Prelude.Read, Int -> PutDetector -> ShowS
[PutDetector] -> ShowS
PutDetector -> String
(Int -> PutDetector -> ShowS)
-> (PutDetector -> String)
-> ([PutDetector] -> ShowS)
-> Show PutDetector
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDetector] -> ShowS
$cshowList :: [PutDetector] -> ShowS
show :: PutDetector -> String
$cshow :: PutDetector -> String
showsPrec :: Int -> PutDetector -> ShowS
$cshowsPrec :: Int -> PutDetector -> ShowS
Prelude.Show, (forall x. PutDetector -> Rep PutDetector x)
-> (forall x. Rep PutDetector x -> PutDetector)
-> Generic PutDetector
forall x. Rep PutDetector x -> PutDetector
forall x. PutDetector -> Rep PutDetector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutDetector x -> PutDetector
$cfrom :: forall x. PutDetector -> Rep PutDetector x
Prelude.Generic)
newPutDetector ::
Prelude.Text ->
Prelude.Text ->
PutDetector
newPutDetector :: Text -> Text -> PutDetector
newPutDetector Text
pDetectorId_ Text
pEventTypeName_ =
PutDetector' :: Maybe Text -> Maybe [Tag] -> Text -> Text -> PutDetector
PutDetector'
{ $sel:description:PutDetector' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:PutDetector' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:PutDetector' :: Text
detectorId = Text
pDetectorId_,
$sel:eventTypeName:PutDetector' :: Text
eventTypeName = Text
pEventTypeName_
}
putDetector_description :: Lens.Lens' PutDetector (Prelude.Maybe Prelude.Text)
putDetector_description :: (Maybe Text -> f (Maybe Text)) -> PutDetector -> f PutDetector
putDetector_description = (PutDetector -> Maybe Text)
-> (PutDetector -> Maybe Text -> PutDetector)
-> Lens PutDetector PutDetector (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDetector' {Maybe Text
description :: Maybe Text
$sel:description:PutDetector' :: PutDetector -> Maybe Text
description} -> Maybe Text
description) (\s :: PutDetector
s@PutDetector' {} Maybe Text
a -> PutDetector
s {$sel:description:PutDetector' :: Maybe Text
description = Maybe Text
a} :: PutDetector)
putDetector_tags :: Lens.Lens' PutDetector (Prelude.Maybe [Tag])
putDetector_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> PutDetector -> f PutDetector
putDetector_tags = (PutDetector -> Maybe [Tag])
-> (PutDetector -> Maybe [Tag] -> PutDetector)
-> Lens PutDetector PutDetector (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDetector' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:PutDetector' :: PutDetector -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: PutDetector
s@PutDetector' {} Maybe [Tag]
a -> PutDetector
s {$sel:tags:PutDetector' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: PutDetector) ((Maybe [Tag] -> f (Maybe [Tag])) -> PutDetector -> f PutDetector)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> PutDetector
-> f PutDetector
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
putDetector_detectorId :: Lens.Lens' PutDetector Prelude.Text
putDetector_detectorId :: (Text -> f Text) -> PutDetector -> f PutDetector
putDetector_detectorId = (PutDetector -> Text)
-> (PutDetector -> Text -> PutDetector)
-> Lens PutDetector PutDetector Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDetector' {Text
detectorId :: Text
$sel:detectorId:PutDetector' :: PutDetector -> Text
detectorId} -> Text
detectorId) (\s :: PutDetector
s@PutDetector' {} Text
a -> PutDetector
s {$sel:detectorId:PutDetector' :: Text
detectorId = Text
a} :: PutDetector)
putDetector_eventTypeName :: Lens.Lens' PutDetector Prelude.Text
putDetector_eventTypeName :: (Text -> f Text) -> PutDetector -> f PutDetector
putDetector_eventTypeName = (PutDetector -> Text)
-> (PutDetector -> Text -> PutDetector)
-> Lens PutDetector PutDetector Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDetector' {Text
eventTypeName :: Text
$sel:eventTypeName:PutDetector' :: PutDetector -> Text
eventTypeName} -> Text
eventTypeName) (\s :: PutDetector
s@PutDetector' {} Text
a -> PutDetector
s {$sel:eventTypeName:PutDetector' :: Text
eventTypeName = Text
a} :: PutDetector)
instance Core.AWSRequest PutDetector where
type AWSResponse PutDetector = PutDetectorResponse
request :: PutDetector -> Request PutDetector
request = Service -> PutDetector -> Request PutDetector
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy PutDetector
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutDetector)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse PutDetector))
-> Logger
-> Service
-> Proxy PutDetector
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutDetector)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> PutDetectorResponse
PutDetectorResponse'
(Int -> PutDetectorResponse)
-> Either String Int -> Either String PutDetectorResponse
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))
)
instance Prelude.Hashable PutDetector
instance Prelude.NFData PutDetector
instance Core.ToHeaders PutDetector where
toHeaders :: PutDetector -> ResponseHeaders
toHeaders =
ResponseHeaders -> PutDetector -> 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
"AWSHawksNestServiceFacade.PutDetector" ::
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 PutDetector where
toJSON :: PutDetector -> Value
toJSON PutDetector' {Maybe [Tag]
Maybe Text
Text
eventTypeName :: Text
detectorId :: Text
tags :: Maybe [Tag]
description :: Maybe Text
$sel:eventTypeName:PutDetector' :: PutDetector -> Text
$sel:detectorId:PutDetector' :: PutDetector -> Text
$sel:tags:PutDetector' :: PutDetector -> Maybe [Tag]
$sel:description:PutDetector' :: PutDetector -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"detectorId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
detectorId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"eventTypeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventTypeName)
]
)
instance Core.ToPath PutDetector where
toPath :: PutDetector -> ByteString
toPath = ByteString -> PutDetector -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery PutDetector where
toQuery :: PutDetector -> QueryString
toQuery = QueryString -> PutDetector -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data PutDetectorResponse = PutDetectorResponse'
{
PutDetectorResponse -> Int
httpStatus :: Prelude.Int
}
deriving (PutDetectorResponse -> PutDetectorResponse -> Bool
(PutDetectorResponse -> PutDetectorResponse -> Bool)
-> (PutDetectorResponse -> PutDetectorResponse -> Bool)
-> Eq PutDetectorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutDetectorResponse -> PutDetectorResponse -> Bool
$c/= :: PutDetectorResponse -> PutDetectorResponse -> Bool
== :: PutDetectorResponse -> PutDetectorResponse -> Bool
$c== :: PutDetectorResponse -> PutDetectorResponse -> Bool
Prelude.Eq, ReadPrec [PutDetectorResponse]
ReadPrec PutDetectorResponse
Int -> ReadS PutDetectorResponse
ReadS [PutDetectorResponse]
(Int -> ReadS PutDetectorResponse)
-> ReadS [PutDetectorResponse]
-> ReadPrec PutDetectorResponse
-> ReadPrec [PutDetectorResponse]
-> Read PutDetectorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutDetectorResponse]
$creadListPrec :: ReadPrec [PutDetectorResponse]
readPrec :: ReadPrec PutDetectorResponse
$creadPrec :: ReadPrec PutDetectorResponse
readList :: ReadS [PutDetectorResponse]
$creadList :: ReadS [PutDetectorResponse]
readsPrec :: Int -> ReadS PutDetectorResponse
$creadsPrec :: Int -> ReadS PutDetectorResponse
Prelude.Read, Int -> PutDetectorResponse -> ShowS
[PutDetectorResponse] -> ShowS
PutDetectorResponse -> String
(Int -> PutDetectorResponse -> ShowS)
-> (PutDetectorResponse -> String)
-> ([PutDetectorResponse] -> ShowS)
-> Show PutDetectorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutDetectorResponse] -> ShowS
$cshowList :: [PutDetectorResponse] -> ShowS
show :: PutDetectorResponse -> String
$cshow :: PutDetectorResponse -> String
showsPrec :: Int -> PutDetectorResponse -> ShowS
$cshowsPrec :: Int -> PutDetectorResponse -> ShowS
Prelude.Show, (forall x. PutDetectorResponse -> Rep PutDetectorResponse x)
-> (forall x. Rep PutDetectorResponse x -> PutDetectorResponse)
-> Generic PutDetectorResponse
forall x. Rep PutDetectorResponse x -> PutDetectorResponse
forall x. PutDetectorResponse -> Rep PutDetectorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutDetectorResponse x -> PutDetectorResponse
$cfrom :: forall x. PutDetectorResponse -> Rep PutDetectorResponse x
Prelude.Generic)
newPutDetectorResponse ::
Prelude.Int ->
PutDetectorResponse
newPutDetectorResponse :: Int -> PutDetectorResponse
newPutDetectorResponse Int
pHttpStatus_ =
PutDetectorResponse' :: Int -> PutDetectorResponse
PutDetectorResponse' {$sel:httpStatus:PutDetectorResponse' :: Int
httpStatus = Int
pHttpStatus_}
putDetectorResponse_httpStatus :: Lens.Lens' PutDetectorResponse Prelude.Int
putDetectorResponse_httpStatus :: (Int -> f Int) -> PutDetectorResponse -> f PutDetectorResponse
putDetectorResponse_httpStatus = (PutDetectorResponse -> Int)
-> (PutDetectorResponse -> Int -> PutDetectorResponse)
-> Lens PutDetectorResponse PutDetectorResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutDetectorResponse' {Int
httpStatus :: Int
$sel:httpStatus:PutDetectorResponse' :: PutDetectorResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: PutDetectorResponse
s@PutDetectorResponse' {} Int
a -> PutDetectorResponse
s {$sel:httpStatus:PutDetectorResponse' :: Int
httpStatus = Int
a} :: PutDetectorResponse)
instance Prelude.NFData PutDetectorResponse