{-# 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.DeleteEventType
-- 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 event type.
--
-- You cannot delete an event type that is used in a detector or a model.
--
-- When you delete an event type, Amazon Fraud Detector permanently deletes
-- that event type and the data is no longer stored in Amazon Fraud
-- Detector.
module Amazonka.FraudDetector.DeleteEventType
  ( -- * Creating a Request
    DeleteEventType (..),
    newDeleteEventType,

    -- * Request Lenses
    deleteEventType_name,

    -- * Destructuring the Response
    DeleteEventTypeResponse (..),
    newDeleteEventTypeResponse,

    -- * Response Lenses
    deleteEventTypeResponse_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:/ 'newDeleteEventType' smart constructor.
data DeleteEventType = DeleteEventType'
  { -- | The name of the event type to delete.
    DeleteEventType -> Text
name :: Prelude.Text
  }
  deriving (DeleteEventType -> DeleteEventType -> Bool
(DeleteEventType -> DeleteEventType -> Bool)
-> (DeleteEventType -> DeleteEventType -> Bool)
-> Eq DeleteEventType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEventType -> DeleteEventType -> Bool
$c/= :: DeleteEventType -> DeleteEventType -> Bool
== :: DeleteEventType -> DeleteEventType -> Bool
$c== :: DeleteEventType -> DeleteEventType -> Bool
Prelude.Eq, ReadPrec [DeleteEventType]
ReadPrec DeleteEventType
Int -> ReadS DeleteEventType
ReadS [DeleteEventType]
(Int -> ReadS DeleteEventType)
-> ReadS [DeleteEventType]
-> ReadPrec DeleteEventType
-> ReadPrec [DeleteEventType]
-> Read DeleteEventType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEventType]
$creadListPrec :: ReadPrec [DeleteEventType]
readPrec :: ReadPrec DeleteEventType
$creadPrec :: ReadPrec DeleteEventType
readList :: ReadS [DeleteEventType]
$creadList :: ReadS [DeleteEventType]
readsPrec :: Int -> ReadS DeleteEventType
$creadsPrec :: Int -> ReadS DeleteEventType
Prelude.Read, Int -> DeleteEventType -> ShowS
[DeleteEventType] -> ShowS
DeleteEventType -> String
(Int -> DeleteEventType -> ShowS)
-> (DeleteEventType -> String)
-> ([DeleteEventType] -> ShowS)
-> Show DeleteEventType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEventType] -> ShowS
$cshowList :: [DeleteEventType] -> ShowS
show :: DeleteEventType -> String
$cshow :: DeleteEventType -> String
showsPrec :: Int -> DeleteEventType -> ShowS
$cshowsPrec :: Int -> DeleteEventType -> ShowS
Prelude.Show, (forall x. DeleteEventType -> Rep DeleteEventType x)
-> (forall x. Rep DeleteEventType x -> DeleteEventType)
-> Generic DeleteEventType
forall x. Rep DeleteEventType x -> DeleteEventType
forall x. DeleteEventType -> Rep DeleteEventType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEventType x -> DeleteEventType
$cfrom :: forall x. DeleteEventType -> Rep DeleteEventType x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEventType' 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', 'deleteEventType_name' - The name of the event type to delete.
newDeleteEventType ::
  -- | 'name'
  Prelude.Text ->
  DeleteEventType
newDeleteEventType :: Text -> DeleteEventType
newDeleteEventType Text
pName_ =
  DeleteEventType' :: Text -> DeleteEventType
DeleteEventType' {$sel:name:DeleteEventType' :: Text
name = Text
pName_}

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

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

instance Prelude.NFData DeleteEventType

instance Core.ToHeaders DeleteEventType where
  toHeaders :: DeleteEventType -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteEventType -> 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.DeleteEventType" ::
                          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 DeleteEventType where
  toJSON :: DeleteEventType -> Value
toJSON DeleteEventType' {Text
name :: Text
$sel:name:DeleteEventType' :: DeleteEventType -> 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 DeleteEventType where
  toPath :: DeleteEventType -> ByteString
toPath = ByteString -> DeleteEventType -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance Prelude.NFData DeleteEventTypeResponse