{-# 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.UpdateModel
(
UpdateModel (..),
newUpdateModel,
updateModel_description,
updateModel_modelId,
updateModel_modelType,
UpdateModelResponse (..),
newUpdateModelResponse,
updateModelResponse_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 UpdateModel = UpdateModel'
{
UpdateModel -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateModel -> Text
modelId :: Prelude.Text,
UpdateModel -> ModelTypeEnum
modelType :: ModelTypeEnum
}
deriving (UpdateModel -> UpdateModel -> Bool
(UpdateModel -> UpdateModel -> Bool)
-> (UpdateModel -> UpdateModel -> Bool) -> Eq UpdateModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateModel -> UpdateModel -> Bool
$c/= :: UpdateModel -> UpdateModel -> Bool
== :: UpdateModel -> UpdateModel -> Bool
$c== :: UpdateModel -> UpdateModel -> Bool
Prelude.Eq, ReadPrec [UpdateModel]
ReadPrec UpdateModel
Int -> ReadS UpdateModel
ReadS [UpdateModel]
(Int -> ReadS UpdateModel)
-> ReadS [UpdateModel]
-> ReadPrec UpdateModel
-> ReadPrec [UpdateModel]
-> Read UpdateModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateModel]
$creadListPrec :: ReadPrec [UpdateModel]
readPrec :: ReadPrec UpdateModel
$creadPrec :: ReadPrec UpdateModel
readList :: ReadS [UpdateModel]
$creadList :: ReadS [UpdateModel]
readsPrec :: Int -> ReadS UpdateModel
$creadsPrec :: Int -> ReadS UpdateModel
Prelude.Read, Int -> UpdateModel -> ShowS
[UpdateModel] -> ShowS
UpdateModel -> String
(Int -> UpdateModel -> ShowS)
-> (UpdateModel -> String)
-> ([UpdateModel] -> ShowS)
-> Show UpdateModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateModel] -> ShowS
$cshowList :: [UpdateModel] -> ShowS
show :: UpdateModel -> String
$cshow :: UpdateModel -> String
showsPrec :: Int -> UpdateModel -> ShowS
$cshowsPrec :: Int -> UpdateModel -> ShowS
Prelude.Show, (forall x. UpdateModel -> Rep UpdateModel x)
-> (forall x. Rep UpdateModel x -> UpdateModel)
-> Generic UpdateModel
forall x. Rep UpdateModel x -> UpdateModel
forall x. UpdateModel -> Rep UpdateModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateModel x -> UpdateModel
$cfrom :: forall x. UpdateModel -> Rep UpdateModel x
Prelude.Generic)
newUpdateModel ::
Prelude.Text ->
ModelTypeEnum ->
UpdateModel
newUpdateModel :: Text -> ModelTypeEnum -> UpdateModel
newUpdateModel Text
pModelId_ ModelTypeEnum
pModelType_ =
UpdateModel' :: Maybe Text -> Text -> ModelTypeEnum -> UpdateModel
UpdateModel'
{ $sel:description:UpdateModel' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:modelId:UpdateModel' :: Text
modelId = Text
pModelId_,
$sel:modelType:UpdateModel' :: ModelTypeEnum
modelType = ModelTypeEnum
pModelType_
}
updateModel_description :: Lens.Lens' UpdateModel (Prelude.Maybe Prelude.Text)
updateModel_description :: (Maybe Text -> f (Maybe Text)) -> UpdateModel -> f UpdateModel
updateModel_description = (UpdateModel -> Maybe Text)
-> (UpdateModel -> Maybe Text -> UpdateModel)
-> Lens UpdateModel UpdateModel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateModel' {Maybe Text
description :: Maybe Text
$sel:description:UpdateModel' :: UpdateModel -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateModel
s@UpdateModel' {} Maybe Text
a -> UpdateModel
s {$sel:description:UpdateModel' :: Maybe Text
description = Maybe Text
a} :: UpdateModel)
updateModel_modelId :: Lens.Lens' UpdateModel Prelude.Text
updateModel_modelId :: (Text -> f Text) -> UpdateModel -> f UpdateModel
updateModel_modelId = (UpdateModel -> Text)
-> (UpdateModel -> Text -> UpdateModel)
-> Lens UpdateModel UpdateModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateModel' {Text
modelId :: Text
$sel:modelId:UpdateModel' :: UpdateModel -> Text
modelId} -> Text
modelId) (\s :: UpdateModel
s@UpdateModel' {} Text
a -> UpdateModel
s {$sel:modelId:UpdateModel' :: Text
modelId = Text
a} :: UpdateModel)
updateModel_modelType :: Lens.Lens' UpdateModel ModelTypeEnum
updateModel_modelType :: (ModelTypeEnum -> f ModelTypeEnum) -> UpdateModel -> f UpdateModel
updateModel_modelType = (UpdateModel -> ModelTypeEnum)
-> (UpdateModel -> ModelTypeEnum -> UpdateModel)
-> Lens UpdateModel UpdateModel ModelTypeEnum ModelTypeEnum
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateModel' {ModelTypeEnum
modelType :: ModelTypeEnum
$sel:modelType:UpdateModel' :: UpdateModel -> ModelTypeEnum
modelType} -> ModelTypeEnum
modelType) (\s :: UpdateModel
s@UpdateModel' {} ModelTypeEnum
a -> UpdateModel
s {$sel:modelType:UpdateModel' :: ModelTypeEnum
modelType = ModelTypeEnum
a} :: UpdateModel)
instance Core.AWSRequest UpdateModel where
type AWSResponse UpdateModel = UpdateModelResponse
request :: UpdateModel -> Request UpdateModel
request = Service -> UpdateModel -> Request UpdateModel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateModel)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateModel))
-> Logger
-> Service
-> Proxy UpdateModel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateModel)))
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 -> UpdateModelResponse
UpdateModelResponse'
(Int -> UpdateModelResponse)
-> Either String Int -> Either String UpdateModelResponse
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 UpdateModel
instance Prelude.NFData UpdateModel
instance Core.ToHeaders UpdateModel where
toHeaders :: UpdateModel -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateModel -> 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.UpdateModel" ::
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 UpdateModel where
toJSON :: UpdateModel -> Value
toJSON UpdateModel' {Maybe Text
Text
ModelTypeEnum
modelType :: ModelTypeEnum
modelId :: Text
description :: Maybe Text
$sel:modelType:UpdateModel' :: UpdateModel -> ModelTypeEnum
$sel:modelId:UpdateModel' :: UpdateModel -> Text
$sel:description:UpdateModel' :: UpdateModel -> 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,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"modelId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
modelId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"modelType" Text -> ModelTypeEnum -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ModelTypeEnum
modelType)
]
)
instance Core.ToPath UpdateModel where
toPath :: UpdateModel -> ByteString
toPath = ByteString -> UpdateModel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateModel where
toQuery :: UpdateModel -> QueryString
toQuery = QueryString -> UpdateModel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateModelResponse = UpdateModelResponse'
{
UpdateModelResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateModelResponse -> UpdateModelResponse -> Bool
(UpdateModelResponse -> UpdateModelResponse -> Bool)
-> (UpdateModelResponse -> UpdateModelResponse -> Bool)
-> Eq UpdateModelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateModelResponse -> UpdateModelResponse -> Bool
$c/= :: UpdateModelResponse -> UpdateModelResponse -> Bool
== :: UpdateModelResponse -> UpdateModelResponse -> Bool
$c== :: UpdateModelResponse -> UpdateModelResponse -> Bool
Prelude.Eq, ReadPrec [UpdateModelResponse]
ReadPrec UpdateModelResponse
Int -> ReadS UpdateModelResponse
ReadS [UpdateModelResponse]
(Int -> ReadS UpdateModelResponse)
-> ReadS [UpdateModelResponse]
-> ReadPrec UpdateModelResponse
-> ReadPrec [UpdateModelResponse]
-> Read UpdateModelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateModelResponse]
$creadListPrec :: ReadPrec [UpdateModelResponse]
readPrec :: ReadPrec UpdateModelResponse
$creadPrec :: ReadPrec UpdateModelResponse
readList :: ReadS [UpdateModelResponse]
$creadList :: ReadS [UpdateModelResponse]
readsPrec :: Int -> ReadS UpdateModelResponse
$creadsPrec :: Int -> ReadS UpdateModelResponse
Prelude.Read, Int -> UpdateModelResponse -> ShowS
[UpdateModelResponse] -> ShowS
UpdateModelResponse -> String
(Int -> UpdateModelResponse -> ShowS)
-> (UpdateModelResponse -> String)
-> ([UpdateModelResponse] -> ShowS)
-> Show UpdateModelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateModelResponse] -> ShowS
$cshowList :: [UpdateModelResponse] -> ShowS
show :: UpdateModelResponse -> String
$cshow :: UpdateModelResponse -> String
showsPrec :: Int -> UpdateModelResponse -> ShowS
$cshowsPrec :: Int -> UpdateModelResponse -> ShowS
Prelude.Show, (forall x. UpdateModelResponse -> Rep UpdateModelResponse x)
-> (forall x. Rep UpdateModelResponse x -> UpdateModelResponse)
-> Generic UpdateModelResponse
forall x. Rep UpdateModelResponse x -> UpdateModelResponse
forall x. UpdateModelResponse -> Rep UpdateModelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateModelResponse x -> UpdateModelResponse
$cfrom :: forall x. UpdateModelResponse -> Rep UpdateModelResponse x
Prelude.Generic)
newUpdateModelResponse ::
Prelude.Int ->
UpdateModelResponse
newUpdateModelResponse :: Int -> UpdateModelResponse
newUpdateModelResponse Int
pHttpStatus_ =
UpdateModelResponse' :: Int -> UpdateModelResponse
UpdateModelResponse' {$sel:httpStatus:UpdateModelResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateModelResponse_httpStatus :: Lens.Lens' UpdateModelResponse Prelude.Int
updateModelResponse_httpStatus :: (Int -> f Int) -> UpdateModelResponse -> f UpdateModelResponse
updateModelResponse_httpStatus = (UpdateModelResponse -> Int)
-> (UpdateModelResponse -> Int -> UpdateModelResponse)
-> Lens UpdateModelResponse UpdateModelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateModelResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateModelResponse' :: UpdateModelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateModelResponse
s@UpdateModelResponse' {} Int
a -> UpdateModelResponse
s {$sel:httpStatus:UpdateModelResponse' :: Int
httpStatus = Int
a} :: UpdateModelResponse)
instance Prelude.NFData UpdateModelResponse