{-# 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.DeleteEventsByEventType
-- 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 all events of a particular event type.
module Amazonka.FraudDetector.DeleteEventsByEventType
  ( -- * Creating a Request
    DeleteEventsByEventType (..),
    newDeleteEventsByEventType,

    -- * Request Lenses
    deleteEventsByEventType_eventTypeName,

    -- * Destructuring the Response
    DeleteEventsByEventTypeResponse (..),
    newDeleteEventsByEventTypeResponse,

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

-- |
-- Create a value of 'DeleteEventsByEventType' 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:
--
-- 'eventTypeName', 'deleteEventsByEventType_eventTypeName' - The name of the event type.
newDeleteEventsByEventType ::
  -- | 'eventTypeName'
  Prelude.Text ->
  DeleteEventsByEventType
newDeleteEventsByEventType :: Text -> DeleteEventsByEventType
newDeleteEventsByEventType Text
pEventTypeName_ =
  DeleteEventsByEventType' :: Text -> DeleteEventsByEventType
DeleteEventsByEventType'
    { $sel:eventTypeName:DeleteEventsByEventType' :: Text
eventTypeName =
        Text
pEventTypeName_
    }

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

instance Core.AWSRequest DeleteEventsByEventType where
  type
    AWSResponse DeleteEventsByEventType =
      DeleteEventsByEventTypeResponse
  request :: DeleteEventsByEventType -> Request DeleteEventsByEventType
request = Service
-> DeleteEventsByEventType -> Request DeleteEventsByEventType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteEventsByEventType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEventsByEventType)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteEventsByEventType))
-> Logger
-> Service
-> Proxy DeleteEventsByEventType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteEventsByEventType)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe Text -> Int -> DeleteEventsByEventTypeResponse
DeleteEventsByEventTypeResponse'
            (Maybe Text
 -> Maybe Text -> Int -> DeleteEventsByEventTypeResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> DeleteEventsByEventTypeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"eventTypeName")
            Either
  String (Maybe Text -> Int -> DeleteEventsByEventTypeResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteEventsByEventTypeResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"eventsDeletionStatus")
            Either String (Int -> DeleteEventsByEventTypeResponse)
-> Either String Int
-> Either String DeleteEventsByEventTypeResponse
forall (f :: * -> *) a b. Applicative f => 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 DeleteEventsByEventType

instance Prelude.NFData DeleteEventsByEventType

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

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

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

-- | /See:/ 'newDeleteEventsByEventTypeResponse' smart constructor.
data DeleteEventsByEventTypeResponse = DeleteEventsByEventTypeResponse'
  { -- | Name of event type for which to delete the events.
    DeleteEventsByEventTypeResponse -> Maybe Text
eventTypeName :: Prelude.Maybe Prelude.Text,
    -- | The status of the delete request.
    DeleteEventsByEventTypeResponse -> Maybe Text
eventsDeletionStatus :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteEventsByEventTypeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteEventsByEventTypeResponse
-> DeleteEventsByEventTypeResponse -> Bool
(DeleteEventsByEventTypeResponse
 -> DeleteEventsByEventTypeResponse -> Bool)
-> (DeleteEventsByEventTypeResponse
    -> DeleteEventsByEventTypeResponse -> Bool)
-> Eq DeleteEventsByEventTypeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteEventsByEventTypeResponse
-> DeleteEventsByEventTypeResponse -> Bool
$c/= :: DeleteEventsByEventTypeResponse
-> DeleteEventsByEventTypeResponse -> Bool
== :: DeleteEventsByEventTypeResponse
-> DeleteEventsByEventTypeResponse -> Bool
$c== :: DeleteEventsByEventTypeResponse
-> DeleteEventsByEventTypeResponse -> Bool
Prelude.Eq, ReadPrec [DeleteEventsByEventTypeResponse]
ReadPrec DeleteEventsByEventTypeResponse
Int -> ReadS DeleteEventsByEventTypeResponse
ReadS [DeleteEventsByEventTypeResponse]
(Int -> ReadS DeleteEventsByEventTypeResponse)
-> ReadS [DeleteEventsByEventTypeResponse]
-> ReadPrec DeleteEventsByEventTypeResponse
-> ReadPrec [DeleteEventsByEventTypeResponse]
-> Read DeleteEventsByEventTypeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteEventsByEventTypeResponse]
$creadListPrec :: ReadPrec [DeleteEventsByEventTypeResponse]
readPrec :: ReadPrec DeleteEventsByEventTypeResponse
$creadPrec :: ReadPrec DeleteEventsByEventTypeResponse
readList :: ReadS [DeleteEventsByEventTypeResponse]
$creadList :: ReadS [DeleteEventsByEventTypeResponse]
readsPrec :: Int -> ReadS DeleteEventsByEventTypeResponse
$creadsPrec :: Int -> ReadS DeleteEventsByEventTypeResponse
Prelude.Read, Int -> DeleteEventsByEventTypeResponse -> ShowS
[DeleteEventsByEventTypeResponse] -> ShowS
DeleteEventsByEventTypeResponse -> String
(Int -> DeleteEventsByEventTypeResponse -> ShowS)
-> (DeleteEventsByEventTypeResponse -> String)
-> ([DeleteEventsByEventTypeResponse] -> ShowS)
-> Show DeleteEventsByEventTypeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteEventsByEventTypeResponse] -> ShowS
$cshowList :: [DeleteEventsByEventTypeResponse] -> ShowS
show :: DeleteEventsByEventTypeResponse -> String
$cshow :: DeleteEventsByEventTypeResponse -> String
showsPrec :: Int -> DeleteEventsByEventTypeResponse -> ShowS
$cshowsPrec :: Int -> DeleteEventsByEventTypeResponse -> ShowS
Prelude.Show, (forall x.
 DeleteEventsByEventTypeResponse
 -> Rep DeleteEventsByEventTypeResponse x)
-> (forall x.
    Rep DeleteEventsByEventTypeResponse x
    -> DeleteEventsByEventTypeResponse)
-> Generic DeleteEventsByEventTypeResponse
forall x.
Rep DeleteEventsByEventTypeResponse x
-> DeleteEventsByEventTypeResponse
forall x.
DeleteEventsByEventTypeResponse
-> Rep DeleteEventsByEventTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteEventsByEventTypeResponse x
-> DeleteEventsByEventTypeResponse
$cfrom :: forall x.
DeleteEventsByEventTypeResponse
-> Rep DeleteEventsByEventTypeResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteEventsByEventTypeResponse' 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:
--
-- 'eventTypeName', 'deleteEventsByEventTypeResponse_eventTypeName' - Name of event type for which to delete the events.
--
-- 'eventsDeletionStatus', 'deleteEventsByEventTypeResponse_eventsDeletionStatus' - The status of the delete request.
--
-- 'httpStatus', 'deleteEventsByEventTypeResponse_httpStatus' - The response's http status code.
newDeleteEventsByEventTypeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteEventsByEventTypeResponse
newDeleteEventsByEventTypeResponse :: Int -> DeleteEventsByEventTypeResponse
newDeleteEventsByEventTypeResponse Int
pHttpStatus_ =
  DeleteEventsByEventTypeResponse' :: Maybe Text -> Maybe Text -> Int -> DeleteEventsByEventTypeResponse
DeleteEventsByEventTypeResponse'
    { $sel:eventTypeName:DeleteEventsByEventTypeResponse' :: Maybe Text
eventTypeName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eventsDeletionStatus:DeleteEventsByEventTypeResponse' :: Maybe Text
eventsDeletionStatus = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteEventsByEventTypeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Name of event type for which to delete the events.
deleteEventsByEventTypeResponse_eventTypeName :: Lens.Lens' DeleteEventsByEventTypeResponse (Prelude.Maybe Prelude.Text)
deleteEventsByEventTypeResponse_eventTypeName :: (Maybe Text -> f (Maybe Text))
-> DeleteEventsByEventTypeResponse
-> f DeleteEventsByEventTypeResponse
deleteEventsByEventTypeResponse_eventTypeName = (DeleteEventsByEventTypeResponse -> Maybe Text)
-> (DeleteEventsByEventTypeResponse
    -> Maybe Text -> DeleteEventsByEventTypeResponse)
-> Lens
     DeleteEventsByEventTypeResponse
     DeleteEventsByEventTypeResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEventsByEventTypeResponse' {Maybe Text
eventTypeName :: Maybe Text
$sel:eventTypeName:DeleteEventsByEventTypeResponse' :: DeleteEventsByEventTypeResponse -> Maybe Text
eventTypeName} -> Maybe Text
eventTypeName) (\s :: DeleteEventsByEventTypeResponse
s@DeleteEventsByEventTypeResponse' {} Maybe Text
a -> DeleteEventsByEventTypeResponse
s {$sel:eventTypeName:DeleteEventsByEventTypeResponse' :: Maybe Text
eventTypeName = Maybe Text
a} :: DeleteEventsByEventTypeResponse)

-- | The status of the delete request.
deleteEventsByEventTypeResponse_eventsDeletionStatus :: Lens.Lens' DeleteEventsByEventTypeResponse (Prelude.Maybe Prelude.Text)
deleteEventsByEventTypeResponse_eventsDeletionStatus :: (Maybe Text -> f (Maybe Text))
-> DeleteEventsByEventTypeResponse
-> f DeleteEventsByEventTypeResponse
deleteEventsByEventTypeResponse_eventsDeletionStatus = (DeleteEventsByEventTypeResponse -> Maybe Text)
-> (DeleteEventsByEventTypeResponse
    -> Maybe Text -> DeleteEventsByEventTypeResponse)
-> Lens
     DeleteEventsByEventTypeResponse
     DeleteEventsByEventTypeResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteEventsByEventTypeResponse' {Maybe Text
eventsDeletionStatus :: Maybe Text
$sel:eventsDeletionStatus:DeleteEventsByEventTypeResponse' :: DeleteEventsByEventTypeResponse -> Maybe Text
eventsDeletionStatus} -> Maybe Text
eventsDeletionStatus) (\s :: DeleteEventsByEventTypeResponse
s@DeleteEventsByEventTypeResponse' {} Maybe Text
a -> DeleteEventsByEventTypeResponse
s {$sel:eventsDeletionStatus:DeleteEventsByEventTypeResponse' :: Maybe Text
eventsDeletionStatus = Maybe Text
a} :: DeleteEventsByEventTypeResponse)

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

instance
  Prelude.NFData
    DeleteEventsByEventTypeResponse