{-# 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.DeleteDatasetImportJob
-- 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 dataset import job created using the CreateDatasetImportJob
-- operation. You can delete only dataset import jobs that have a status of
-- @ACTIVE@ or @CREATE_FAILED@. To get the status, use the
-- DescribeDatasetImportJob operation.
module Amazonka.Forecast.DeleteDatasetImportJob
  ( -- * Creating a Request
    DeleteDatasetImportJob (..),
    newDeleteDatasetImportJob,

    -- * Request Lenses
    deleteDatasetImportJob_datasetImportJobArn,

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

-- |
-- Create a value of 'DeleteDatasetImportJob' 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:
--
-- 'datasetImportJobArn', 'deleteDatasetImportJob_datasetImportJobArn' - The Amazon Resource Name (ARN) of the dataset import job to delete.
newDeleteDatasetImportJob ::
  -- | 'datasetImportJobArn'
  Prelude.Text ->
  DeleteDatasetImportJob
newDeleteDatasetImportJob :: Text -> DeleteDatasetImportJob
newDeleteDatasetImportJob Text
pDatasetImportJobArn_ =
  DeleteDatasetImportJob' :: Text -> DeleteDatasetImportJob
DeleteDatasetImportJob'
    { $sel:datasetImportJobArn:DeleteDatasetImportJob' :: Text
datasetImportJobArn =
        Text
pDatasetImportJobArn_
    }

-- | The Amazon Resource Name (ARN) of the dataset import job to delete.
deleteDatasetImportJob_datasetImportJobArn :: Lens.Lens' DeleteDatasetImportJob Prelude.Text
deleteDatasetImportJob_datasetImportJobArn :: (Text -> f Text)
-> DeleteDatasetImportJob -> f DeleteDatasetImportJob
deleteDatasetImportJob_datasetImportJobArn = (DeleteDatasetImportJob -> Text)
-> (DeleteDatasetImportJob -> Text -> DeleteDatasetImportJob)
-> Lens DeleteDatasetImportJob DeleteDatasetImportJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDatasetImportJob' {Text
datasetImportJobArn :: Text
$sel:datasetImportJobArn:DeleteDatasetImportJob' :: DeleteDatasetImportJob -> Text
datasetImportJobArn} -> Text
datasetImportJobArn) (\s :: DeleteDatasetImportJob
s@DeleteDatasetImportJob' {} Text
a -> DeleteDatasetImportJob
s {$sel:datasetImportJobArn:DeleteDatasetImportJob' :: Text
datasetImportJobArn = Text
a} :: DeleteDatasetImportJob)

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

instance Prelude.Hashable DeleteDatasetImportJob

instance Prelude.NFData DeleteDatasetImportJob

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

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

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

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

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

instance
  Prelude.NFData
    DeleteDatasetImportJobResponse