{-# 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-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 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 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:/ 'newDeleteOutcome' smart constructor.
data DeleteOutcome = DeleteOutcome'
  { -- | The name of the outcome to delete.
    DeleteOutcome -> Text
name :: Prelude.Text
  }
  deriving (DeleteOutcome -> DeleteOutcome -> Bool
(DeleteOutcome -> DeleteOutcome -> Bool)
-> (DeleteOutcome -> DeleteOutcome -> Bool) -> Eq DeleteOutcome
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]
(Int -> ReadS DeleteOutcome)
-> ReadS [DeleteOutcome]
-> ReadPrec DeleteOutcome
-> ReadPrec [DeleteOutcome]
-> Read 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
(Int -> DeleteOutcome -> ShowS)
-> (DeleteOutcome -> String)
-> ([DeleteOutcome] -> ShowS)
-> Show DeleteOutcome
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. DeleteOutcome -> Rep DeleteOutcome x)
-> (forall x. Rep DeleteOutcome x -> DeleteOutcome)
-> Generic DeleteOutcome
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' :: Text -> DeleteOutcome
DeleteOutcome' {$sel:name:DeleteOutcome' :: Text
name = Text
pName_}

-- | The name of the outcome to delete.
deleteOutcome_name :: Lens.Lens' DeleteOutcome Prelude.Text
deleteOutcome_name :: (Text -> f Text) -> DeleteOutcome -> f DeleteOutcome
deleteOutcome_name = (DeleteOutcome -> Text)
-> (DeleteOutcome -> Text -> DeleteOutcome)
-> Lens DeleteOutcome DeleteOutcome Text Text
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 :: DeleteOutcome -> Request DeleteOutcome
request = Service -> DeleteOutcome -> Request DeleteOutcome
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteOutcome
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteOutcome)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteOutcome))
-> Logger
-> Service
-> Proxy DeleteOutcome
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteOutcome)))
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 -> DeleteOutcomeResponse
DeleteOutcomeResponse'
            (Int -> DeleteOutcomeResponse)
-> Either String Int -> Either String DeleteOutcomeResponse
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 DeleteOutcome

instance Prelude.NFData DeleteOutcome

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

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

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