{-# 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.DeleteEntityType
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an entity type.
--
-- You cannot delete an entity type that is included in an event type.
--
-- When you delete an entity type, Amazon Fraud Detector permanently
-- deletes that entity type and the data is no longer stored in Amazon
-- Fraud Detector.
module Amazonka.FraudDetector.DeleteEntityType
  ( -- * Creating a Request
    DeleteEntityType (..),
    newDeleteEntityType,

    -- * Request Lenses
    deleteEntityType_name,

    -- * Destructuring the Response
    DeleteEntityTypeResponse (..),
    newDeleteEntityTypeResponse,

    -- * Response Lenses
    deleteEntityTypeResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FraudDetector.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'DeleteEntityType' 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:
--
-- 'name', 'deleteEntityType_name' - The name of the entity type to delete.
newDeleteEntityType ::
  -- | 'name'
  Prelude.Text ->
  DeleteEntityType
newDeleteEntityType :: Text -> DeleteEntityType
newDeleteEntityType Text
pName_ =
  DeleteEntityType' {$sel:name:DeleteEntityType' :: Text
name = Text
pName_}

-- | The name of the entity type to delete.
deleteEntityType_name :: Lens.Lens' DeleteEntityType Prelude.Text
deleteEntityType_name :: Lens' DeleteEntityType Text
deleteEntityType_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEntityType' {Text
name :: Text
$sel:name:DeleteEntityType' :: DeleteEntityType -> Text
name} -> Text
name) (\s :: DeleteEntityType
s@DeleteEntityType' {} Text
a -> DeleteEntityType
s {$sel:name:DeleteEntityType' :: Text
name = Text
a} :: DeleteEntityType)

instance Core.AWSRequest DeleteEntityType where
  type
    AWSResponse DeleteEntityType =
      DeleteEntityTypeResponse
  request :: (Service -> Service)
-> DeleteEntityType -> Request DeleteEntityType
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 DeleteEntityType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteEntityType)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteEntityTypeResponse
DeleteEntityTypeResponse'
            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))
      )

instance Prelude.Hashable DeleteEntityType where
  hashWithSalt :: Int -> DeleteEntityType -> Int
hashWithSalt Int
_salt DeleteEntityType' {Text
name :: Text
$sel:name:DeleteEntityType' :: DeleteEntityType -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData DeleteEntityType where
  rnf :: DeleteEntityType -> ()
rnf DeleteEntityType' {Text
name :: Text
$sel:name:DeleteEntityType' :: DeleteEntityType -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders DeleteEntityType where
  toHeaders :: DeleteEntityType -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSHawksNestServiceFacade.DeleteEntityType" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteEntityType where
  toJSON :: DeleteEntityType -> Value
toJSON DeleteEntityType' {Text
name :: Text
$sel:name:DeleteEntityType' :: DeleteEntityType -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
      )

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

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

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

-- |
-- Create a value of 'DeleteEntityTypeResponse' 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', 'deleteEntityTypeResponse_httpStatus' - The response's http status code.
newDeleteEntityTypeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteEntityTypeResponse
newDeleteEntityTypeResponse :: Int -> DeleteEntityTypeResponse
newDeleteEntityTypeResponse Int
pHttpStatus_ =
  DeleteEntityTypeResponse'
    { $sel:httpStatus:DeleteEntityTypeResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData DeleteEntityTypeResponse where
  rnf :: DeleteEntityTypeResponse -> ()
rnf DeleteEntityTypeResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteEntityTypeResponse' :: DeleteEntityTypeResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus