{-# 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.MachineLearning.DeleteBatchPrediction
-- 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)
--
-- Assigns the DELETED status to a @BatchPrediction@, rendering it
-- unusable.
--
-- After using the @DeleteBatchPrediction@ operation, you can use the
-- GetBatchPrediction operation to verify that the status of the
-- @BatchPrediction@ changed to DELETED.
--
-- __Caution:__ The result of the @DeleteBatchPrediction@ operation is
-- irreversible.
module Amazonka.MachineLearning.DeleteBatchPrediction
  ( -- * Creating a Request
    DeleteBatchPrediction (..),
    newDeleteBatchPrediction,

    -- * Request Lenses
    deleteBatchPrediction_batchPredictionId,

    -- * Destructuring the Response
    DeleteBatchPredictionResponse (..),
    newDeleteBatchPredictionResponse,

    -- * Response Lenses
    deleteBatchPredictionResponse_batchPredictionId,
    deleteBatchPredictionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MachineLearning.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteBatchPrediction' smart constructor.
data DeleteBatchPrediction = DeleteBatchPrediction'
  { -- | A user-supplied ID that uniquely identifies the @BatchPrediction@.
    DeleteBatchPrediction -> Text
batchPredictionId :: Prelude.Text
  }
  deriving (DeleteBatchPrediction -> DeleteBatchPrediction -> Bool
(DeleteBatchPrediction -> DeleteBatchPrediction -> Bool)
-> (DeleteBatchPrediction -> DeleteBatchPrediction -> Bool)
-> Eq DeleteBatchPrediction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBatchPrediction -> DeleteBatchPrediction -> Bool
$c/= :: DeleteBatchPrediction -> DeleteBatchPrediction -> Bool
== :: DeleteBatchPrediction -> DeleteBatchPrediction -> Bool
$c== :: DeleteBatchPrediction -> DeleteBatchPrediction -> Bool
Prelude.Eq, ReadPrec [DeleteBatchPrediction]
ReadPrec DeleteBatchPrediction
Int -> ReadS DeleteBatchPrediction
ReadS [DeleteBatchPrediction]
(Int -> ReadS DeleteBatchPrediction)
-> ReadS [DeleteBatchPrediction]
-> ReadPrec DeleteBatchPrediction
-> ReadPrec [DeleteBatchPrediction]
-> Read DeleteBatchPrediction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBatchPrediction]
$creadListPrec :: ReadPrec [DeleteBatchPrediction]
readPrec :: ReadPrec DeleteBatchPrediction
$creadPrec :: ReadPrec DeleteBatchPrediction
readList :: ReadS [DeleteBatchPrediction]
$creadList :: ReadS [DeleteBatchPrediction]
readsPrec :: Int -> ReadS DeleteBatchPrediction
$creadsPrec :: Int -> ReadS DeleteBatchPrediction
Prelude.Read, Int -> DeleteBatchPrediction -> ShowS
[DeleteBatchPrediction] -> ShowS
DeleteBatchPrediction -> String
(Int -> DeleteBatchPrediction -> ShowS)
-> (DeleteBatchPrediction -> String)
-> ([DeleteBatchPrediction] -> ShowS)
-> Show DeleteBatchPrediction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBatchPrediction] -> ShowS
$cshowList :: [DeleteBatchPrediction] -> ShowS
show :: DeleteBatchPrediction -> String
$cshow :: DeleteBatchPrediction -> String
showsPrec :: Int -> DeleteBatchPrediction -> ShowS
$cshowsPrec :: Int -> DeleteBatchPrediction -> ShowS
Prelude.Show, (forall x. DeleteBatchPrediction -> Rep DeleteBatchPrediction x)
-> (forall x. Rep DeleteBatchPrediction x -> DeleteBatchPrediction)
-> Generic DeleteBatchPrediction
forall x. Rep DeleteBatchPrediction x -> DeleteBatchPrediction
forall x. DeleteBatchPrediction -> Rep DeleteBatchPrediction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBatchPrediction x -> DeleteBatchPrediction
$cfrom :: forall x. DeleteBatchPrediction -> Rep DeleteBatchPrediction x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBatchPrediction' 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:
--
-- 'batchPredictionId', 'deleteBatchPrediction_batchPredictionId' - A user-supplied ID that uniquely identifies the @BatchPrediction@.
newDeleteBatchPrediction ::
  -- | 'batchPredictionId'
  Prelude.Text ->
  DeleteBatchPrediction
newDeleteBatchPrediction :: Text -> DeleteBatchPrediction
newDeleteBatchPrediction Text
pBatchPredictionId_ =
  DeleteBatchPrediction' :: Text -> DeleteBatchPrediction
DeleteBatchPrediction'
    { $sel:batchPredictionId:DeleteBatchPrediction' :: Text
batchPredictionId =
        Text
pBatchPredictionId_
    }

-- | A user-supplied ID that uniquely identifies the @BatchPrediction@.
deleteBatchPrediction_batchPredictionId :: Lens.Lens' DeleteBatchPrediction Prelude.Text
deleteBatchPrediction_batchPredictionId :: (Text -> f Text)
-> DeleteBatchPrediction -> f DeleteBatchPrediction
deleteBatchPrediction_batchPredictionId = (DeleteBatchPrediction -> Text)
-> (DeleteBatchPrediction -> Text -> DeleteBatchPrediction)
-> Lens DeleteBatchPrediction DeleteBatchPrediction Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBatchPrediction' {Text
batchPredictionId :: Text
$sel:batchPredictionId:DeleteBatchPrediction' :: DeleteBatchPrediction -> Text
batchPredictionId} -> Text
batchPredictionId) (\s :: DeleteBatchPrediction
s@DeleteBatchPrediction' {} Text
a -> DeleteBatchPrediction
s {$sel:batchPredictionId:DeleteBatchPrediction' :: Text
batchPredictionId = Text
a} :: DeleteBatchPrediction)

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

instance Prelude.NFData DeleteBatchPrediction

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

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

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

-- | Represents the output of a @DeleteBatchPrediction@ operation.
--
-- You can use the @GetBatchPrediction@ operation and check the value of
-- the @Status@ parameter to see whether a @BatchPrediction@ is marked as
-- @DELETED@.
--
-- /See:/ 'newDeleteBatchPredictionResponse' smart constructor.
data DeleteBatchPredictionResponse = DeleteBatchPredictionResponse'
  { -- | A user-supplied ID that uniquely identifies the @BatchPrediction@. This
    -- value should be identical to the value of the @BatchPredictionID@ in the
    -- request.
    DeleteBatchPredictionResponse -> Maybe Text
batchPredictionId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteBatchPredictionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteBatchPredictionResponse
-> DeleteBatchPredictionResponse -> Bool
(DeleteBatchPredictionResponse
 -> DeleteBatchPredictionResponse -> Bool)
-> (DeleteBatchPredictionResponse
    -> DeleteBatchPredictionResponse -> Bool)
-> Eq DeleteBatchPredictionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBatchPredictionResponse
-> DeleteBatchPredictionResponse -> Bool
$c/= :: DeleteBatchPredictionResponse
-> DeleteBatchPredictionResponse -> Bool
== :: DeleteBatchPredictionResponse
-> DeleteBatchPredictionResponse -> Bool
$c== :: DeleteBatchPredictionResponse
-> DeleteBatchPredictionResponse -> Bool
Prelude.Eq, ReadPrec [DeleteBatchPredictionResponse]
ReadPrec DeleteBatchPredictionResponse
Int -> ReadS DeleteBatchPredictionResponse
ReadS [DeleteBatchPredictionResponse]
(Int -> ReadS DeleteBatchPredictionResponse)
-> ReadS [DeleteBatchPredictionResponse]
-> ReadPrec DeleteBatchPredictionResponse
-> ReadPrec [DeleteBatchPredictionResponse]
-> Read DeleteBatchPredictionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBatchPredictionResponse]
$creadListPrec :: ReadPrec [DeleteBatchPredictionResponse]
readPrec :: ReadPrec DeleteBatchPredictionResponse
$creadPrec :: ReadPrec DeleteBatchPredictionResponse
readList :: ReadS [DeleteBatchPredictionResponse]
$creadList :: ReadS [DeleteBatchPredictionResponse]
readsPrec :: Int -> ReadS DeleteBatchPredictionResponse
$creadsPrec :: Int -> ReadS DeleteBatchPredictionResponse
Prelude.Read, Int -> DeleteBatchPredictionResponse -> ShowS
[DeleteBatchPredictionResponse] -> ShowS
DeleteBatchPredictionResponse -> String
(Int -> DeleteBatchPredictionResponse -> ShowS)
-> (DeleteBatchPredictionResponse -> String)
-> ([DeleteBatchPredictionResponse] -> ShowS)
-> Show DeleteBatchPredictionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBatchPredictionResponse] -> ShowS
$cshowList :: [DeleteBatchPredictionResponse] -> ShowS
show :: DeleteBatchPredictionResponse -> String
$cshow :: DeleteBatchPredictionResponse -> String
showsPrec :: Int -> DeleteBatchPredictionResponse -> ShowS
$cshowsPrec :: Int -> DeleteBatchPredictionResponse -> ShowS
Prelude.Show, (forall x.
 DeleteBatchPredictionResponse
 -> Rep DeleteBatchPredictionResponse x)
-> (forall x.
    Rep DeleteBatchPredictionResponse x
    -> DeleteBatchPredictionResponse)
-> Generic DeleteBatchPredictionResponse
forall x.
Rep DeleteBatchPredictionResponse x
-> DeleteBatchPredictionResponse
forall x.
DeleteBatchPredictionResponse
-> Rep DeleteBatchPredictionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteBatchPredictionResponse x
-> DeleteBatchPredictionResponse
$cfrom :: forall x.
DeleteBatchPredictionResponse
-> Rep DeleteBatchPredictionResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBatchPredictionResponse' 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:
--
-- 'batchPredictionId', 'deleteBatchPredictionResponse_batchPredictionId' - A user-supplied ID that uniquely identifies the @BatchPrediction@. This
-- value should be identical to the value of the @BatchPredictionID@ in the
-- request.
--
-- 'httpStatus', 'deleteBatchPredictionResponse_httpStatus' - The response's http status code.
newDeleteBatchPredictionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteBatchPredictionResponse
newDeleteBatchPredictionResponse :: Int -> DeleteBatchPredictionResponse
newDeleteBatchPredictionResponse Int
pHttpStatus_ =
  DeleteBatchPredictionResponse' :: Maybe Text -> Int -> DeleteBatchPredictionResponse
DeleteBatchPredictionResponse'
    { $sel:batchPredictionId:DeleteBatchPredictionResponse' :: Maybe Text
batchPredictionId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteBatchPredictionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A user-supplied ID that uniquely identifies the @BatchPrediction@. This
-- value should be identical to the value of the @BatchPredictionID@ in the
-- request.
deleteBatchPredictionResponse_batchPredictionId :: Lens.Lens' DeleteBatchPredictionResponse (Prelude.Maybe Prelude.Text)
deleteBatchPredictionResponse_batchPredictionId :: (Maybe Text -> f (Maybe Text))
-> DeleteBatchPredictionResponse -> f DeleteBatchPredictionResponse
deleteBatchPredictionResponse_batchPredictionId = (DeleteBatchPredictionResponse -> Maybe Text)
-> (DeleteBatchPredictionResponse
    -> Maybe Text -> DeleteBatchPredictionResponse)
-> Lens
     DeleteBatchPredictionResponse
     DeleteBatchPredictionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBatchPredictionResponse' {Maybe Text
batchPredictionId :: Maybe Text
$sel:batchPredictionId:DeleteBatchPredictionResponse' :: DeleteBatchPredictionResponse -> Maybe Text
batchPredictionId} -> Maybe Text
batchPredictionId) (\s :: DeleteBatchPredictionResponse
s@DeleteBatchPredictionResponse' {} Maybe Text
a -> DeleteBatchPredictionResponse
s {$sel:batchPredictionId:DeleteBatchPredictionResponse' :: Maybe Text
batchPredictionId = Maybe Text
a} :: DeleteBatchPredictionResponse)

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

instance Prelude.NFData DeleteBatchPredictionResponse