{-# 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.DeleteEvent
-- 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 the specified event.
--
-- When you delete an event, Amazon Fraud Detector permanently deletes that
-- event and the event data is no longer stored in Amazon Fraud Detector.
module Amazonka.FraudDetector.DeleteEvent
  ( -- * Creating a Request
    DeleteEvent (..),
    newDeleteEvent,

    -- * Request Lenses
    deleteEvent_deleteAuditHistory,
    deleteEvent_eventId,
    deleteEvent_eventTypeName,

    -- * Destructuring the Response
    DeleteEventResponse (..),
    newDeleteEventResponse,

    -- * Response Lenses
    deleteEventResponse_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:/ 'newDeleteEvent' smart constructor.
data DeleteEvent = DeleteEvent'
  { -- | Specifies whether or not to delete any predictions associated with the
    -- event.
    DeleteEvent -> Maybe Bool
deleteAuditHistory :: Prelude.Maybe Prelude.Bool,
    -- | The ID of the event to delete.
    DeleteEvent -> Text
eventId :: Prelude.Text,
    -- | The name of the event type.
    DeleteEvent -> Text
eventTypeName :: Prelude.Text
  }
  deriving (DeleteEvent -> DeleteEvent -> Bool
(DeleteEvent -> DeleteEvent -> Bool)
-> (DeleteEvent -> DeleteEvent -> Bool) -> Eq DeleteEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEvent -> DeleteEvent -> Bool
$c/= :: DeleteEvent -> DeleteEvent -> Bool
== :: DeleteEvent -> DeleteEvent -> Bool
$c== :: DeleteEvent -> DeleteEvent -> Bool
Prelude.Eq, ReadPrec [DeleteEvent]
ReadPrec DeleteEvent
Int -> ReadS DeleteEvent
ReadS [DeleteEvent]
(Int -> ReadS DeleteEvent)
-> ReadS [DeleteEvent]
-> ReadPrec DeleteEvent
-> ReadPrec [DeleteEvent]
-> Read DeleteEvent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEvent]
$creadListPrec :: ReadPrec [DeleteEvent]
readPrec :: ReadPrec DeleteEvent
$creadPrec :: ReadPrec DeleteEvent
readList :: ReadS [DeleteEvent]
$creadList :: ReadS [DeleteEvent]
readsPrec :: Int -> ReadS DeleteEvent
$creadsPrec :: Int -> ReadS DeleteEvent
Prelude.Read, Int -> DeleteEvent -> ShowS
[DeleteEvent] -> ShowS
DeleteEvent -> String
(Int -> DeleteEvent -> ShowS)
-> (DeleteEvent -> String)
-> ([DeleteEvent] -> ShowS)
-> Show DeleteEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEvent] -> ShowS
$cshowList :: [DeleteEvent] -> ShowS
show :: DeleteEvent -> String
$cshow :: DeleteEvent -> String
showsPrec :: Int -> DeleteEvent -> ShowS
$cshowsPrec :: Int -> DeleteEvent -> ShowS
Prelude.Show, (forall x. DeleteEvent -> Rep DeleteEvent x)
-> (forall x. Rep DeleteEvent x -> DeleteEvent)
-> Generic DeleteEvent
forall x. Rep DeleteEvent x -> DeleteEvent
forall x. DeleteEvent -> Rep DeleteEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteEvent x -> DeleteEvent
$cfrom :: forall x. DeleteEvent -> Rep DeleteEvent x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEvent' 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:
--
-- 'deleteAuditHistory', 'deleteEvent_deleteAuditHistory' - Specifies whether or not to delete any predictions associated with the
-- event.
--
-- 'eventId', 'deleteEvent_eventId' - The ID of the event to delete.
--
-- 'eventTypeName', 'deleteEvent_eventTypeName' - The name of the event type.
newDeleteEvent ::
  -- | 'eventId'
  Prelude.Text ->
  -- | 'eventTypeName'
  Prelude.Text ->
  DeleteEvent
newDeleteEvent :: Text -> Text -> DeleteEvent
newDeleteEvent Text
pEventId_ Text
pEventTypeName_ =
  DeleteEvent' :: Maybe Bool -> Text -> Text -> DeleteEvent
DeleteEvent'
    { $sel:deleteAuditHistory:DeleteEvent' :: Maybe Bool
deleteAuditHistory = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:eventId:DeleteEvent' :: Text
eventId = Text
pEventId_,
      $sel:eventTypeName:DeleteEvent' :: Text
eventTypeName = Text
pEventTypeName_
    }

-- | Specifies whether or not to delete any predictions associated with the
-- event.
deleteEvent_deleteAuditHistory :: Lens.Lens' DeleteEvent (Prelude.Maybe Prelude.Bool)
deleteEvent_deleteAuditHistory :: (Maybe Bool -> f (Maybe Bool)) -> DeleteEvent -> f DeleteEvent
deleteEvent_deleteAuditHistory = (DeleteEvent -> Maybe Bool)
-> (DeleteEvent -> Maybe Bool -> DeleteEvent)
-> Lens DeleteEvent DeleteEvent (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEvent' {Maybe Bool
deleteAuditHistory :: Maybe Bool
$sel:deleteAuditHistory:DeleteEvent' :: DeleteEvent -> Maybe Bool
deleteAuditHistory} -> Maybe Bool
deleteAuditHistory) (\s :: DeleteEvent
s@DeleteEvent' {} Maybe Bool
a -> DeleteEvent
s {$sel:deleteAuditHistory:DeleteEvent' :: Maybe Bool
deleteAuditHistory = Maybe Bool
a} :: DeleteEvent)

-- | The ID of the event to delete.
deleteEvent_eventId :: Lens.Lens' DeleteEvent Prelude.Text
deleteEvent_eventId :: (Text -> f Text) -> DeleteEvent -> f DeleteEvent
deleteEvent_eventId = (DeleteEvent -> Text)
-> (DeleteEvent -> Text -> DeleteEvent)
-> Lens DeleteEvent DeleteEvent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEvent' {Text
eventId :: Text
$sel:eventId:DeleteEvent' :: DeleteEvent -> Text
eventId} -> Text
eventId) (\s :: DeleteEvent
s@DeleteEvent' {} Text
a -> DeleteEvent
s {$sel:eventId:DeleteEvent' :: Text
eventId = Text
a} :: DeleteEvent)

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

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

instance Prelude.NFData DeleteEvent

instance Core.ToHeaders DeleteEvent where
  toHeaders :: DeleteEvent -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteEvent -> 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.DeleteEvent" ::
                          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 DeleteEvent where
  toJSON :: DeleteEvent -> Value
toJSON DeleteEvent' {Maybe Bool
Text
eventTypeName :: Text
eventId :: Text
deleteAuditHistory :: Maybe Bool
$sel:eventTypeName:DeleteEvent' :: DeleteEvent -> Text
$sel:eventId:DeleteEvent' :: DeleteEvent -> Text
$sel:deleteAuditHistory:DeleteEvent' :: DeleteEvent -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"deleteAuditHistory" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
deleteAuditHistory,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"eventId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"eventTypeName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
eventTypeName)
          ]
      )

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

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

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

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

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

instance Prelude.NFData DeleteEventResponse