{-# 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.DeleteForecast
-- 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 forecast created using the CreateForecast operation. You can
-- delete only forecasts that have a status of @ACTIVE@ or @CREATE_FAILED@.
-- To get the status, use the DescribeForecast operation.
--
-- You can\'t delete a forecast while it is being exported. After a
-- forecast is deleted, you can no longer query the forecast.
module Amazonka.Forecast.DeleteForecast
  ( -- * Creating a Request
    DeleteForecast (..),
    newDeleteForecast,

    -- * Request Lenses
    deleteForecast_forecastArn,

    -- * Destructuring the Response
    DeleteForecastResponse (..),
    newDeleteForecastResponse,
  )
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:/ 'newDeleteForecast' smart constructor.
data DeleteForecast = DeleteForecast'
  { -- | The Amazon Resource Name (ARN) of the forecast to delete.
    DeleteForecast -> Text
forecastArn :: Prelude.Text
  }
  deriving (DeleteForecast -> DeleteForecast -> Bool
(DeleteForecast -> DeleteForecast -> Bool)
-> (DeleteForecast -> DeleteForecast -> Bool) -> Eq DeleteForecast
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteForecast -> DeleteForecast -> Bool
$c/= :: DeleteForecast -> DeleteForecast -> Bool
== :: DeleteForecast -> DeleteForecast -> Bool
$c== :: DeleteForecast -> DeleteForecast -> Bool
Prelude.Eq, ReadPrec [DeleteForecast]
ReadPrec DeleteForecast
Int -> ReadS DeleteForecast
ReadS [DeleteForecast]
(Int -> ReadS DeleteForecast)
-> ReadS [DeleteForecast]
-> ReadPrec DeleteForecast
-> ReadPrec [DeleteForecast]
-> Read DeleteForecast
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteForecast]
$creadListPrec :: ReadPrec [DeleteForecast]
readPrec :: ReadPrec DeleteForecast
$creadPrec :: ReadPrec DeleteForecast
readList :: ReadS [DeleteForecast]
$creadList :: ReadS [DeleteForecast]
readsPrec :: Int -> ReadS DeleteForecast
$creadsPrec :: Int -> ReadS DeleteForecast
Prelude.Read, Int -> DeleteForecast -> ShowS
[DeleteForecast] -> ShowS
DeleteForecast -> String
(Int -> DeleteForecast -> ShowS)
-> (DeleteForecast -> String)
-> ([DeleteForecast] -> ShowS)
-> Show DeleteForecast
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteForecast] -> ShowS
$cshowList :: [DeleteForecast] -> ShowS
show :: DeleteForecast -> String
$cshow :: DeleteForecast -> String
showsPrec :: Int -> DeleteForecast -> ShowS
$cshowsPrec :: Int -> DeleteForecast -> ShowS
Prelude.Show, (forall x. DeleteForecast -> Rep DeleteForecast x)
-> (forall x. Rep DeleteForecast x -> DeleteForecast)
-> Generic DeleteForecast
forall x. Rep DeleteForecast x -> DeleteForecast
forall x. DeleteForecast -> Rep DeleteForecast x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteForecast x -> DeleteForecast
$cfrom :: forall x. DeleteForecast -> Rep DeleteForecast x
Prelude.Generic)

-- |
-- Create a value of 'DeleteForecast' 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:
--
-- 'forecastArn', 'deleteForecast_forecastArn' - The Amazon Resource Name (ARN) of the forecast to delete.
newDeleteForecast ::
  -- | 'forecastArn'
  Prelude.Text ->
  DeleteForecast
newDeleteForecast :: Text -> DeleteForecast
newDeleteForecast Text
pForecastArn_ =
  DeleteForecast' :: Text -> DeleteForecast
DeleteForecast' {$sel:forecastArn:DeleteForecast' :: Text
forecastArn = Text
pForecastArn_}

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

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

instance Prelude.Hashable DeleteForecast

instance Prelude.NFData DeleteForecast

instance Core.ToHeaders DeleteForecast where
  toHeaders :: DeleteForecast -> [Header]
toHeaders =
    [Header] -> DeleteForecast -> [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.DeleteForecast" ::
                          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 DeleteForecast where
  toJSON :: DeleteForecast -> Value
toJSON DeleteForecast' {Text
forecastArn :: Text
$sel:forecastArn:DeleteForecast' :: DeleteForecast -> 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
"ForecastArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
forecastArn)]
      )

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

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

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

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

instance Prelude.NFData DeleteForecastResponse