{-# 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.DeleteOutcome
-- 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 outcome.
--
-- You cannot delete an outcome that is used in a rule version.
--
-- When you delete an outcome, Amazon Fraud Detector permanently deletes
-- that outcome and the data is no longer stored in Amazon Fraud Detector.
module Amazonka.FraudDetector.DeleteOutcome
  ( -- * Creating a Request
    DeleteOutcome (..),
    newDeleteOutcome,

    -- * Request Lenses
    deleteOutcome_name,

    -- * Destructuring the Response
    DeleteOutcomeResponse (..),
    newDeleteOutcomeResponse,

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

-- |
-- Create a value of 'DeleteOutcome' 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', 'deleteOutcome_name' - The name of the outcome to delete.
newDeleteOutcome ::
  -- | 'name'
  Prelude.Text ->
  DeleteOutcome
newDeleteOutcome :: Text -> DeleteOutcome
newDeleteOutcome Text
pName_ =
  DeleteOutcome' {$sel:name:DeleteOutcome' :: Text
name = Text
pName_}

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

instance Core.AWSRequest DeleteOutcome where
  type
    AWSResponse DeleteOutcome =
      DeleteOutcomeResponse
  request :: (Service -> Service) -> DeleteOutcome -> Request DeleteOutcome
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 DeleteOutcome
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteOutcome)))
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 -> DeleteOutcomeResponse
DeleteOutcomeResponse'
            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 DeleteOutcome where
  hashWithSalt :: Int -> DeleteOutcome -> Int
hashWithSalt Int
_salt DeleteOutcome' {Text
name :: Text
$sel:name:DeleteOutcome' :: DeleteOutcome -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

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

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

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

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

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

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

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