{-# 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.Forecast.DeletePredictor
-- 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 predictor created using the CreatePredictor operation. You can
-- delete only predictor that have a status of @ACTIVE@ or @CREATE_FAILED@.
-- To get the status, use the DescribePredictor operation.
module Amazonka.Forecast.DeletePredictor
  ( -- * Creating a Request
    DeletePredictor (..),
    newDeletePredictor,

    -- * Request Lenses
    deletePredictor_predictorArn,

    -- * Destructuring the Response
    DeletePredictorResponse (..),
    newDeletePredictorResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Forecast.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:/ 'newDeletePredictor' smart constructor.
data DeletePredictor = DeletePredictor'
  { -- | The Amazon Resource Name (ARN) of the predictor to delete.
    DeletePredictor -> Text
predictorArn :: Prelude.Text
  }
  deriving (DeletePredictor -> DeletePredictor -> Bool
(DeletePredictor -> DeletePredictor -> Bool)
-> (DeletePredictor -> DeletePredictor -> Bool)
-> Eq DeletePredictor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePredictor -> DeletePredictor -> Bool
$c/= :: DeletePredictor -> DeletePredictor -> Bool
== :: DeletePredictor -> DeletePredictor -> Bool
$c== :: DeletePredictor -> DeletePredictor -> Bool
Prelude.Eq, ReadPrec [DeletePredictor]
ReadPrec DeletePredictor
Int -> ReadS DeletePredictor
ReadS [DeletePredictor]
(Int -> ReadS DeletePredictor)
-> ReadS [DeletePredictor]
-> ReadPrec DeletePredictor
-> ReadPrec [DeletePredictor]
-> Read DeletePredictor
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePredictor]
$creadListPrec :: ReadPrec [DeletePredictor]
readPrec :: ReadPrec DeletePredictor
$creadPrec :: ReadPrec DeletePredictor
readList :: ReadS [DeletePredictor]
$creadList :: ReadS [DeletePredictor]
readsPrec :: Int -> ReadS DeletePredictor
$creadsPrec :: Int -> ReadS DeletePredictor
Prelude.Read, Int -> DeletePredictor -> ShowS
[DeletePredictor] -> ShowS
DeletePredictor -> String
(Int -> DeletePredictor -> ShowS)
-> (DeletePredictor -> String)
-> ([DeletePredictor] -> ShowS)
-> Show DeletePredictor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePredictor] -> ShowS
$cshowList :: [DeletePredictor] -> ShowS
show :: DeletePredictor -> String
$cshow :: DeletePredictor -> String
showsPrec :: Int -> DeletePredictor -> ShowS
$cshowsPrec :: Int -> DeletePredictor -> ShowS
Prelude.Show, (forall x. DeletePredictor -> Rep DeletePredictor x)
-> (forall x. Rep DeletePredictor x -> DeletePredictor)
-> Generic DeletePredictor
forall x. Rep DeletePredictor x -> DeletePredictor
forall x. DeletePredictor -> Rep DeletePredictor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePredictor x -> DeletePredictor
$cfrom :: forall x. DeletePredictor -> Rep DeletePredictor x
Prelude.Generic)

-- |
-- Create a value of 'DeletePredictor' 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:
--
-- 'predictorArn', 'deletePredictor_predictorArn' - The Amazon Resource Name (ARN) of the predictor to delete.
newDeletePredictor ::
  -- | 'predictorArn'
  Prelude.Text ->
  DeletePredictor
newDeletePredictor :: Text -> DeletePredictor
newDeletePredictor Text
pPredictorArn_ =
  DeletePredictor' :: Text -> DeletePredictor
DeletePredictor' {$sel:predictorArn:DeletePredictor' :: Text
predictorArn = Text
pPredictorArn_}

-- | The Amazon Resource Name (ARN) of the predictor to delete.
deletePredictor_predictorArn :: Lens.Lens' DeletePredictor Prelude.Text
deletePredictor_predictorArn :: (Text -> f Text) -> DeletePredictor -> f DeletePredictor
deletePredictor_predictorArn = (DeletePredictor -> Text)
-> (DeletePredictor -> Text -> DeletePredictor)
-> Lens DeletePredictor DeletePredictor Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePredictor' {Text
predictorArn :: Text
$sel:predictorArn:DeletePredictor' :: DeletePredictor -> Text
predictorArn} -> Text
predictorArn) (\s :: DeletePredictor
s@DeletePredictor' {} Text
a -> DeletePredictor
s {$sel:predictorArn:DeletePredictor' :: Text
predictorArn = Text
a} :: DeletePredictor)

instance Core.AWSRequest DeletePredictor where
  type
    AWSResponse DeletePredictor =
      DeletePredictorResponse
  request :: DeletePredictor -> Request DeletePredictor
request = Service -> DeletePredictor -> Request DeletePredictor
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeletePredictor
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeletePredictor)))
response =
    AWSResponse DeletePredictor
-> Logger
-> Service
-> Proxy DeletePredictor
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeletePredictor)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeletePredictor
DeletePredictorResponse
DeletePredictorResponse'

instance Prelude.Hashable DeletePredictor

instance Prelude.NFData DeletePredictor

instance Core.ToHeaders DeletePredictor where
  toHeaders :: DeletePredictor -> [Header]
toHeaders =
    [Header] -> DeletePredictor -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"AmazonForecast.DeletePredictor" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

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

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

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

-- |
-- Create a value of 'DeletePredictorResponse' 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.
newDeletePredictorResponse ::
  DeletePredictorResponse
newDeletePredictorResponse :: DeletePredictorResponse
newDeletePredictorResponse = DeletePredictorResponse
DeletePredictorResponse'

instance Prelude.NFData DeletePredictorResponse