{-# 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.DeleteVariable
-- 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 a variable.
--
-- You can\'t delete variables that are included in an event type in Amazon
-- Fraud Detector.
--
-- Amazon Fraud Detector automatically deletes model output variables and
-- SageMaker model output variables when you delete the model. You can\'t
-- delete these variables manually.
--
-- When you delete a variable, Amazon Fraud Detector permanently deletes
-- that variable and the data is no longer stored in Amazon Fraud Detector.
module Amazonka.FraudDetector.DeleteVariable
  ( -- * Creating a Request
    DeleteVariable (..),
    newDeleteVariable,

    -- * Request Lenses
    deleteVariable_name,

    -- * Destructuring the Response
    DeleteVariableResponse (..),
    newDeleteVariableResponse,

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

-- |
-- Create a value of 'DeleteVariable' 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', 'deleteVariable_name' - The name of the variable to delete.
newDeleteVariable ::
  -- | 'name'
  Prelude.Text ->
  DeleteVariable
newDeleteVariable :: Text -> DeleteVariable
newDeleteVariable Text
pName_ =
  DeleteVariable' :: Text -> DeleteVariable
DeleteVariable' {$sel:name:DeleteVariable' :: Text
name = Text
pName_}

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

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

instance Prelude.NFData DeleteVariable

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

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

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

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

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

instance Prelude.NFData DeleteVariableResponse