{-# 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.IoTAnalytics.DeleteDatasetContent
-- 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 the content of the specified dataset.
module Amazonka.IoTAnalytics.DeleteDatasetContent
  ( -- * Creating a Request
    DeleteDatasetContent (..),
    newDeleteDatasetContent,

    -- * Request Lenses
    deleteDatasetContent_versionId,
    deleteDatasetContent_datasetName,

    -- * Destructuring the Response
    DeleteDatasetContentResponse (..),
    newDeleteDatasetContentResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.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:/ 'newDeleteDatasetContent' smart constructor.
data DeleteDatasetContent = DeleteDatasetContent'
  { -- | The version of the dataset whose content is deleted. You can also use
    -- the strings \"$LATEST\" or \"$LATEST_SUCCEEDED\" to delete the latest or
    -- latest successfully completed data set. If not specified,
    -- \"$LATEST_SUCCEEDED\" is the default.
    DeleteDatasetContent -> Maybe Text
versionId :: Prelude.Maybe Prelude.Text,
    -- | The name of the dataset whose content is deleted.
    DeleteDatasetContent -> Text
datasetName :: Prelude.Text
  }
  deriving (DeleteDatasetContent -> DeleteDatasetContent -> Bool
(DeleteDatasetContent -> DeleteDatasetContent -> Bool)
-> (DeleteDatasetContent -> DeleteDatasetContent -> Bool)
-> Eq DeleteDatasetContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDatasetContent -> DeleteDatasetContent -> Bool
$c/= :: DeleteDatasetContent -> DeleteDatasetContent -> Bool
== :: DeleteDatasetContent -> DeleteDatasetContent -> Bool
$c== :: DeleteDatasetContent -> DeleteDatasetContent -> Bool
Prelude.Eq, ReadPrec [DeleteDatasetContent]
ReadPrec DeleteDatasetContent
Int -> ReadS DeleteDatasetContent
ReadS [DeleteDatasetContent]
(Int -> ReadS DeleteDatasetContent)
-> ReadS [DeleteDatasetContent]
-> ReadPrec DeleteDatasetContent
-> ReadPrec [DeleteDatasetContent]
-> Read DeleteDatasetContent
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDatasetContent]
$creadListPrec :: ReadPrec [DeleteDatasetContent]
readPrec :: ReadPrec DeleteDatasetContent
$creadPrec :: ReadPrec DeleteDatasetContent
readList :: ReadS [DeleteDatasetContent]
$creadList :: ReadS [DeleteDatasetContent]
readsPrec :: Int -> ReadS DeleteDatasetContent
$creadsPrec :: Int -> ReadS DeleteDatasetContent
Prelude.Read, Int -> DeleteDatasetContent -> ShowS
[DeleteDatasetContent] -> ShowS
DeleteDatasetContent -> String
(Int -> DeleteDatasetContent -> ShowS)
-> (DeleteDatasetContent -> String)
-> ([DeleteDatasetContent] -> ShowS)
-> Show DeleteDatasetContent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDatasetContent] -> ShowS
$cshowList :: [DeleteDatasetContent] -> ShowS
show :: DeleteDatasetContent -> String
$cshow :: DeleteDatasetContent -> String
showsPrec :: Int -> DeleteDatasetContent -> ShowS
$cshowsPrec :: Int -> DeleteDatasetContent -> ShowS
Prelude.Show, (forall x. DeleteDatasetContent -> Rep DeleteDatasetContent x)
-> (forall x. Rep DeleteDatasetContent x -> DeleteDatasetContent)
-> Generic DeleteDatasetContent
forall x. Rep DeleteDatasetContent x -> DeleteDatasetContent
forall x. DeleteDatasetContent -> Rep DeleteDatasetContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDatasetContent x -> DeleteDatasetContent
$cfrom :: forall x. DeleteDatasetContent -> Rep DeleteDatasetContent x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDatasetContent' 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:
--
-- 'versionId', 'deleteDatasetContent_versionId' - The version of the dataset whose content is deleted. You can also use
-- the strings \"$LATEST\" or \"$LATEST_SUCCEEDED\" to delete the latest or
-- latest successfully completed data set. If not specified,
-- \"$LATEST_SUCCEEDED\" is the default.
--
-- 'datasetName', 'deleteDatasetContent_datasetName' - The name of the dataset whose content is deleted.
newDeleteDatasetContent ::
  -- | 'datasetName'
  Prelude.Text ->
  DeleteDatasetContent
newDeleteDatasetContent :: Text -> DeleteDatasetContent
newDeleteDatasetContent Text
pDatasetName_ =
  DeleteDatasetContent' :: Maybe Text -> Text -> DeleteDatasetContent
DeleteDatasetContent'
    { $sel:versionId:DeleteDatasetContent' :: Maybe Text
versionId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:datasetName:DeleteDatasetContent' :: Text
datasetName = Text
pDatasetName_
    }

-- | The version of the dataset whose content is deleted. You can also use
-- the strings \"$LATEST\" or \"$LATEST_SUCCEEDED\" to delete the latest or
-- latest successfully completed data set. If not specified,
-- \"$LATEST_SUCCEEDED\" is the default.
deleteDatasetContent_versionId :: Lens.Lens' DeleteDatasetContent (Prelude.Maybe Prelude.Text)
deleteDatasetContent_versionId :: (Maybe Text -> f (Maybe Text))
-> DeleteDatasetContent -> f DeleteDatasetContent
deleteDatasetContent_versionId = (DeleteDatasetContent -> Maybe Text)
-> (DeleteDatasetContent -> Maybe Text -> DeleteDatasetContent)
-> Lens
     DeleteDatasetContent DeleteDatasetContent (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDatasetContent' {Maybe Text
versionId :: Maybe Text
$sel:versionId:DeleteDatasetContent' :: DeleteDatasetContent -> Maybe Text
versionId} -> Maybe Text
versionId) (\s :: DeleteDatasetContent
s@DeleteDatasetContent' {} Maybe Text
a -> DeleteDatasetContent
s {$sel:versionId:DeleteDatasetContent' :: Maybe Text
versionId = Maybe Text
a} :: DeleteDatasetContent)

-- | The name of the dataset whose content is deleted.
deleteDatasetContent_datasetName :: Lens.Lens' DeleteDatasetContent Prelude.Text
deleteDatasetContent_datasetName :: (Text -> f Text) -> DeleteDatasetContent -> f DeleteDatasetContent
deleteDatasetContent_datasetName = (DeleteDatasetContent -> Text)
-> (DeleteDatasetContent -> Text -> DeleteDatasetContent)
-> Lens DeleteDatasetContent DeleteDatasetContent Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDatasetContent' {Text
datasetName :: Text
$sel:datasetName:DeleteDatasetContent' :: DeleteDatasetContent -> Text
datasetName} -> Text
datasetName) (\s :: DeleteDatasetContent
s@DeleteDatasetContent' {} Text
a -> DeleteDatasetContent
s {$sel:datasetName:DeleteDatasetContent' :: Text
datasetName = Text
a} :: DeleteDatasetContent)

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

instance Prelude.Hashable DeleteDatasetContent

instance Prelude.NFData DeleteDatasetContent

instance Core.ToHeaders DeleteDatasetContent where
  toHeaders :: DeleteDatasetContent -> [Header]
toHeaders = [Header] -> DeleteDatasetContent -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DeleteDatasetContent where
  toPath :: DeleteDatasetContent -> ByteString
toPath DeleteDatasetContent' {Maybe Text
Text
datasetName :: Text
versionId :: Maybe Text
$sel:datasetName:DeleteDatasetContent' :: DeleteDatasetContent -> Text
$sel:versionId:DeleteDatasetContent' :: DeleteDatasetContent -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/datasets/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
datasetName, ByteString
"/content"]

instance Core.ToQuery DeleteDatasetContent where
  toQuery :: DeleteDatasetContent -> QueryString
toQuery DeleteDatasetContent' {Maybe Text
Text
datasetName :: Text
versionId :: Maybe Text
$sel:datasetName:DeleteDatasetContent' :: DeleteDatasetContent -> Text
$sel:versionId:DeleteDatasetContent' :: DeleteDatasetContent -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"versionId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
versionId]

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

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

instance Prelude.NFData DeleteDatasetContentResponse