{-# 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-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)
--
-- 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 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:/ 'newDeleteEntityType' smart constructor.
data DeleteEntityType = DeleteEntityType'
  { -- | The name of the entity type to delete.
    DeleteEntityType -> Text
name :: Prelude.Text
  }
  deriving (DeleteEntityType -> DeleteEntityType -> Bool
(DeleteEntityType -> DeleteEntityType -> Bool)
-> (DeleteEntityType -> DeleteEntityType -> Bool)
-> Eq DeleteEntityType
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]
(Int -> ReadS DeleteEntityType)
-> ReadS [DeleteEntityType]
-> ReadPrec DeleteEntityType
-> ReadPrec [DeleteEntityType]
-> Read 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
(Int -> DeleteEntityType -> ShowS)
-> (DeleteEntityType -> String)
-> ([DeleteEntityType] -> ShowS)
-> Show DeleteEntityType
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. DeleteEntityType -> Rep DeleteEntityType x)
-> (forall x. Rep DeleteEntityType x -> DeleteEntityType)
-> Generic DeleteEntityType
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' :: Text -> DeleteEntityType
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 :: (Text -> f Text) -> DeleteEntityType -> f DeleteEntityType
deleteEntityType_name = (DeleteEntityType -> Text)
-> (DeleteEntityType -> Text -> DeleteEntityType)
-> Lens DeleteEntityType DeleteEntityType Text Text
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 :: DeleteEntityType -> Request DeleteEntityType
request = Service -> DeleteEntityType -> Request DeleteEntityType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteEntityType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteEntityType)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteEntityType))
-> Logger
-> Service
-> Proxy DeleteEntityType
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteEntityType)))
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 -> DeleteEntityTypeResponse
DeleteEntityTypeResponse'
            (Int -> DeleteEntityTypeResponse)
-> Either String Int -> Either String DeleteEntityTypeResponse
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 DeleteEntityType

instance Prelude.NFData DeleteEntityType

instance Core.ToHeaders DeleteEntityType where
  toHeaders :: DeleteEntityType -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteEntityType -> 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.DeleteEntityType" ::
                          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 DeleteEntityType where
  toJSON :: DeleteEntityType -> Value
toJSON DeleteEntityType' {Text
name :: Text
$sel:name:DeleteEntityType' :: DeleteEntityType -> 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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
      )

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

instance Core.ToQuery DeleteEntityType where
  toQuery :: DeleteEntityType -> QueryString
toQuery = QueryString -> DeleteEntityType -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteEntityTypeResponse -> DeleteEntityTypeResponse -> Bool)
-> (DeleteEntityTypeResponse -> DeleteEntityTypeResponse -> Bool)
-> Eq DeleteEntityTypeResponse
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]
(Int -> ReadS DeleteEntityTypeResponse)
-> ReadS [DeleteEntityTypeResponse]
-> ReadPrec DeleteEntityTypeResponse
-> ReadPrec [DeleteEntityTypeResponse]
-> Read 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
(Int -> DeleteEntityTypeResponse -> ShowS)
-> (DeleteEntityTypeResponse -> String)
-> ([DeleteEntityTypeResponse] -> ShowS)
-> Show DeleteEntityTypeResponse
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.
 DeleteEntityTypeResponse -> Rep DeleteEntityTypeResponse x)
-> (forall x.
    Rep DeleteEntityTypeResponse x -> DeleteEntityTypeResponse)
-> Generic DeleteEntityTypeResponse
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' :: Int -> DeleteEntityTypeResponse
DeleteEntityTypeResponse'
    { $sel:httpStatus:DeleteEntityTypeResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteEntityTypeResponse_httpStatus :: Lens.Lens' DeleteEntityTypeResponse Prelude.Int
deleteEntityTypeResponse_httpStatus :: (Int -> f Int)
-> DeleteEntityTypeResponse -> f DeleteEntityTypeResponse
deleteEntityTypeResponse_httpStatus = (DeleteEntityTypeResponse -> Int)
-> (DeleteEntityTypeResponse -> Int -> DeleteEntityTypeResponse)
-> Lens DeleteEntityTypeResponse DeleteEntityTypeResponse Int Int
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