{-# 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.DeleteDatasetGroup
-- 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 group created using the CreateDatasetGroup operation.
-- You can only delete dataset groups that have a status of @ACTIVE@,
-- @CREATE_FAILED@, or @UPDATE_FAILED@. To get the status, use the
-- DescribeDatasetGroup operation.
--
-- This operation deletes only the dataset group, not the datasets in the
-- group.
module Amazonka.Forecast.DeleteDatasetGroup
  ( -- * Creating a Request
    DeleteDatasetGroup (..),
    newDeleteDatasetGroup,

    -- * Request Lenses
    deleteDatasetGroup_datasetGroupArn,

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

-- |
-- Create a value of 'DeleteDatasetGroup' 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:
--
-- 'datasetGroupArn', 'deleteDatasetGroup_datasetGroupArn' - The Amazon Resource Name (ARN) of the dataset group to delete.
newDeleteDatasetGroup ::
  -- | 'datasetGroupArn'
  Prelude.Text ->
  DeleteDatasetGroup
newDeleteDatasetGroup :: Text -> DeleteDatasetGroup
newDeleteDatasetGroup Text
pDatasetGroupArn_ =
  DeleteDatasetGroup' :: Text -> DeleteDatasetGroup
DeleteDatasetGroup'
    { $sel:datasetGroupArn:DeleteDatasetGroup' :: Text
datasetGroupArn =
        Text
pDatasetGroupArn_
    }

-- | The Amazon Resource Name (ARN) of the dataset group to delete.
deleteDatasetGroup_datasetGroupArn :: Lens.Lens' DeleteDatasetGroup Prelude.Text
deleteDatasetGroup_datasetGroupArn :: (Text -> f Text) -> DeleteDatasetGroup -> f DeleteDatasetGroup
deleteDatasetGroup_datasetGroupArn = (DeleteDatasetGroup -> Text)
-> (DeleteDatasetGroup -> Text -> DeleteDatasetGroup)
-> Lens DeleteDatasetGroup DeleteDatasetGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDatasetGroup' {Text
datasetGroupArn :: Text
$sel:datasetGroupArn:DeleteDatasetGroup' :: DeleteDatasetGroup -> Text
datasetGroupArn} -> Text
datasetGroupArn) (\s :: DeleteDatasetGroup
s@DeleteDatasetGroup' {} Text
a -> DeleteDatasetGroup
s {$sel:datasetGroupArn:DeleteDatasetGroup' :: Text
datasetGroupArn = Text
a} :: DeleteDatasetGroup)

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

instance Prelude.Hashable DeleteDatasetGroup

instance Prelude.NFData DeleteDatasetGroup

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

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

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

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

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

instance Prelude.NFData DeleteDatasetGroupResponse