{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.FraudDetector.DeleteExternalModel
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Removes a SageMaker model from Amazon Fraud Detector.
--
-- You can remove an Amazon SageMaker model if it is not associated with a
-- detector version. Removing a SageMaker model disconnects it from Amazon
-- Fraud Detector, but the model remains available in SageMaker.
module Amazonka.FraudDetector.DeleteExternalModel
  ( -- * Creating a Request
    DeleteExternalModel (..),
    newDeleteExternalModel,

    -- * Request Lenses
    deleteExternalModel_modelEndpoint,

    -- * Destructuring the Response
    DeleteExternalModelResponse (..),
    newDeleteExternalModelResponse,

    -- * Response Lenses
    deleteExternalModelResponse_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

-- | /See:/ 'newDeleteExternalModel' smart constructor.
data DeleteExternalModel = DeleteExternalModel'
  { -- | The endpoint of the Amazon Sagemaker model to delete.
    DeleteExternalModel -> Text
modelEndpoint :: Prelude.Text
  }
  deriving (DeleteExternalModel -> DeleteExternalModel -> Bool
(DeleteExternalModel -> DeleteExternalModel -> Bool)
-> (DeleteExternalModel -> DeleteExternalModel -> Bool)
-> Eq DeleteExternalModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteExternalModel -> DeleteExternalModel -> Bool
$c/= :: DeleteExternalModel -> DeleteExternalModel -> Bool
== :: DeleteExternalModel -> DeleteExternalModel -> Bool
$c== :: DeleteExternalModel -> DeleteExternalModel -> Bool
Prelude.Eq, ReadPrec [DeleteExternalModel]
ReadPrec DeleteExternalModel
Int -> ReadS DeleteExternalModel
ReadS [DeleteExternalModel]
(Int -> ReadS DeleteExternalModel)
-> ReadS [DeleteExternalModel]
-> ReadPrec DeleteExternalModel
-> ReadPrec [DeleteExternalModel]
-> Read DeleteExternalModel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteExternalModel]
$creadListPrec :: ReadPrec [DeleteExternalModel]
readPrec :: ReadPrec DeleteExternalModel
$creadPrec :: ReadPrec DeleteExternalModel
readList :: ReadS [DeleteExternalModel]
$creadList :: ReadS [DeleteExternalModel]
readsPrec :: Int -> ReadS DeleteExternalModel
$creadsPrec :: Int -> ReadS DeleteExternalModel
Prelude.Read, Int -> DeleteExternalModel -> ShowS
[DeleteExternalModel] -> ShowS
DeleteExternalModel -> String
(Int -> DeleteExternalModel -> ShowS)
-> (DeleteExternalModel -> String)
-> ([DeleteExternalModel] -> ShowS)
-> Show DeleteExternalModel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteExternalModel] -> ShowS
$cshowList :: [DeleteExternalModel] -> ShowS
show :: DeleteExternalModel -> String
$cshow :: DeleteExternalModel -> String
showsPrec :: Int -> DeleteExternalModel -> ShowS
$cshowsPrec :: Int -> DeleteExternalModel -> ShowS
Prelude.Show, (forall x. DeleteExternalModel -> Rep DeleteExternalModel x)
-> (forall x. Rep DeleteExternalModel x -> DeleteExternalModel)
-> Generic DeleteExternalModel
forall x. Rep DeleteExternalModel x -> DeleteExternalModel
forall x. DeleteExternalModel -> Rep DeleteExternalModel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteExternalModel x -> DeleteExternalModel
$cfrom :: forall x. DeleteExternalModel -> Rep DeleteExternalModel x
Prelude.Generic)

-- |
-- Create a value of 'DeleteExternalModel' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'modelEndpoint', 'deleteExternalModel_modelEndpoint' - The endpoint of the Amazon Sagemaker model to delete.
newDeleteExternalModel ::
  -- | 'modelEndpoint'
  Prelude.Text ->
  DeleteExternalModel
newDeleteExternalModel :: Text -> DeleteExternalModel
newDeleteExternalModel Text
pModelEndpoint_ =
  DeleteExternalModel' :: Text -> DeleteExternalModel
DeleteExternalModel'
    { $sel:modelEndpoint:DeleteExternalModel' :: Text
modelEndpoint =
        Text
pModelEndpoint_
    }

-- | The endpoint of the Amazon Sagemaker model to delete.
deleteExternalModel_modelEndpoint :: Lens.Lens' DeleteExternalModel Prelude.Text
deleteExternalModel_modelEndpoint :: (Text -> f Text) -> DeleteExternalModel -> f DeleteExternalModel
deleteExternalModel_modelEndpoint = (DeleteExternalModel -> Text)
-> (DeleteExternalModel -> Text -> DeleteExternalModel)
-> Lens DeleteExternalModel DeleteExternalModel Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteExternalModel' {Text
modelEndpoint :: Text
$sel:modelEndpoint:DeleteExternalModel' :: DeleteExternalModel -> Text
modelEndpoint} -> Text
modelEndpoint) (\s :: DeleteExternalModel
s@DeleteExternalModel' {} Text
a -> DeleteExternalModel
s {$sel:modelEndpoint:DeleteExternalModel' :: Text
modelEndpoint = Text
a} :: DeleteExternalModel)

instance Core.AWSRequest DeleteExternalModel where
  type
    AWSResponse DeleteExternalModel =
      DeleteExternalModelResponse
  request :: DeleteExternalModel -> Request DeleteExternalModel
request = Service -> DeleteExternalModel -> Request DeleteExternalModel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteExternalModel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteExternalModel)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteExternalModel))
-> Logger
-> Service
-> Proxy DeleteExternalModel
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteExternalModel)))
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 -> DeleteExternalModelResponse
DeleteExternalModelResponse'
            (Int -> DeleteExternalModelResponse)
-> Either String Int -> Either String DeleteExternalModelResponse
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 DeleteExternalModel

instance Prelude.NFData DeleteExternalModel

instance Core.ToHeaders DeleteExternalModel where
  toHeaders :: DeleteExternalModel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteExternalModel -> 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.DeleteExternalModel" ::
                          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 DeleteExternalModel where
  toJSON :: DeleteExternalModel -> Value
toJSON DeleteExternalModel' {Text
modelEndpoint :: Text
$sel:modelEndpoint:DeleteExternalModel' :: DeleteExternalModel -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"modelEndpoint" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
modelEndpoint)
          ]
      )

instance Core.ToPath DeleteExternalModel where
  toPath :: DeleteExternalModel -> ByteString
toPath = ByteString -> DeleteExternalModel -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DeleteExternalModel where
  toQuery :: DeleteExternalModel -> QueryString
toQuery = QueryString -> DeleteExternalModel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDeleteExternalModelResponse' smart constructor.
data DeleteExternalModelResponse = DeleteExternalModelResponse'
  { -- | The response's http status code.
    DeleteExternalModelResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteExternalModelResponse -> DeleteExternalModelResponse -> Bool
(DeleteExternalModelResponse
 -> DeleteExternalModelResponse -> Bool)
-> (DeleteExternalModelResponse
    -> DeleteExternalModelResponse -> Bool)
-> Eq DeleteExternalModelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteExternalModelResponse -> DeleteExternalModelResponse -> Bool
$c/= :: DeleteExternalModelResponse -> DeleteExternalModelResponse -> Bool
== :: DeleteExternalModelResponse -> DeleteExternalModelResponse -> Bool
$c== :: DeleteExternalModelResponse -> DeleteExternalModelResponse -> Bool
Prelude.Eq, ReadPrec [DeleteExternalModelResponse]
ReadPrec DeleteExternalModelResponse
Int -> ReadS DeleteExternalModelResponse
ReadS [DeleteExternalModelResponse]
(Int -> ReadS DeleteExternalModelResponse)
-> ReadS [DeleteExternalModelResponse]
-> ReadPrec DeleteExternalModelResponse
-> ReadPrec [DeleteExternalModelResponse]
-> Read DeleteExternalModelResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteExternalModelResponse]
$creadListPrec :: ReadPrec [DeleteExternalModelResponse]
readPrec :: ReadPrec DeleteExternalModelResponse
$creadPrec :: ReadPrec DeleteExternalModelResponse
readList :: ReadS [DeleteExternalModelResponse]
$creadList :: ReadS [DeleteExternalModelResponse]
readsPrec :: Int -> ReadS DeleteExternalModelResponse
$creadsPrec :: Int -> ReadS DeleteExternalModelResponse
Prelude.Read, Int -> DeleteExternalModelResponse -> ShowS
[DeleteExternalModelResponse] -> ShowS
DeleteExternalModelResponse -> String
(Int -> DeleteExternalModelResponse -> ShowS)
-> (DeleteExternalModelResponse -> String)
-> ([DeleteExternalModelResponse] -> ShowS)
-> Show DeleteExternalModelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteExternalModelResponse] -> ShowS
$cshowList :: [DeleteExternalModelResponse] -> ShowS
show :: DeleteExternalModelResponse -> String
$cshow :: DeleteExternalModelResponse -> String
showsPrec :: Int -> DeleteExternalModelResponse -> ShowS
$cshowsPrec :: Int -> DeleteExternalModelResponse -> ShowS
Prelude.Show, (forall x.
 DeleteExternalModelResponse -> Rep DeleteExternalModelResponse x)
-> (forall x.
    Rep DeleteExternalModelResponse x -> DeleteExternalModelResponse)
-> Generic DeleteExternalModelResponse
forall x.
Rep DeleteExternalModelResponse x -> DeleteExternalModelResponse
forall x.
DeleteExternalModelResponse -> Rep DeleteExternalModelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteExternalModelResponse x -> DeleteExternalModelResponse
$cfrom :: forall x.
DeleteExternalModelResponse -> Rep DeleteExternalModelResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteExternalModelResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'deleteExternalModelResponse_httpStatus' - The response's http status code.
newDeleteExternalModelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteExternalModelResponse
newDeleteExternalModelResponse :: Int -> DeleteExternalModelResponse
newDeleteExternalModelResponse Int
pHttpStatus_ =
  DeleteExternalModelResponse' :: Int -> DeleteExternalModelResponse
DeleteExternalModelResponse'
    { $sel:httpStatus:DeleteExternalModelResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteExternalModelResponse_httpStatus :: Lens.Lens' DeleteExternalModelResponse Prelude.Int
deleteExternalModelResponse_httpStatus :: (Int -> f Int)
-> DeleteExternalModelResponse -> f DeleteExternalModelResponse
deleteExternalModelResponse_httpStatus = (DeleteExternalModelResponse -> Int)
-> (DeleteExternalModelResponse
    -> Int -> DeleteExternalModelResponse)
-> Lens
     DeleteExternalModelResponse DeleteExternalModelResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteExternalModelResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteExternalModelResponse' :: DeleteExternalModelResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteExternalModelResponse
s@DeleteExternalModelResponse' {} Int
a -> DeleteExternalModelResponse
s {$sel:httpStatus:DeleteExternalModelResponse' :: Int
httpStatus = Int
a} :: DeleteExternalModelResponse)

instance Prelude.NFData DeleteExternalModelResponse