{-# 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.QuickSight.DeleteDataSet
-- 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.
module Amazonka.QuickSight.DeleteDataSet
  ( -- * Creating a Request
    DeleteDataSet (..),
    newDeleteDataSet,

    -- * Request Lenses
    deleteDataSet_awsAccountId,
    deleteDataSet_dataSetId,

    -- * Destructuring the Response
    DeleteDataSetResponse (..),
    newDeleteDataSetResponse,

    -- * Response Lenses
    deleteDataSetResponse_requestId,
    deleteDataSetResponse_arn,
    deleteDataSetResponse_dataSetId,
    deleteDataSetResponse_status,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.QuickSight.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteDataSet' smart constructor.
data DeleteDataSet = DeleteDataSet'
  { -- | The Amazon Web Services account ID.
    DeleteDataSet -> Text
awsAccountId :: Prelude.Text,
    -- | The ID for the dataset that you want to create. This ID is unique per
    -- Amazon Web Services Region for each Amazon Web Services account.
    DeleteDataSet -> Text
dataSetId :: Prelude.Text
  }
  deriving (DeleteDataSet -> DeleteDataSet -> Bool
(DeleteDataSet -> DeleteDataSet -> Bool)
-> (DeleteDataSet -> DeleteDataSet -> Bool) -> Eq DeleteDataSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDataSet -> DeleteDataSet -> Bool
$c/= :: DeleteDataSet -> DeleteDataSet -> Bool
== :: DeleteDataSet -> DeleteDataSet -> Bool
$c== :: DeleteDataSet -> DeleteDataSet -> Bool
Prelude.Eq, ReadPrec [DeleteDataSet]
ReadPrec DeleteDataSet
Int -> ReadS DeleteDataSet
ReadS [DeleteDataSet]
(Int -> ReadS DeleteDataSet)
-> ReadS [DeleteDataSet]
-> ReadPrec DeleteDataSet
-> ReadPrec [DeleteDataSet]
-> Read DeleteDataSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDataSet]
$creadListPrec :: ReadPrec [DeleteDataSet]
readPrec :: ReadPrec DeleteDataSet
$creadPrec :: ReadPrec DeleteDataSet
readList :: ReadS [DeleteDataSet]
$creadList :: ReadS [DeleteDataSet]
readsPrec :: Int -> ReadS DeleteDataSet
$creadsPrec :: Int -> ReadS DeleteDataSet
Prelude.Read, Int -> DeleteDataSet -> ShowS
[DeleteDataSet] -> ShowS
DeleteDataSet -> String
(Int -> DeleteDataSet -> ShowS)
-> (DeleteDataSet -> String)
-> ([DeleteDataSet] -> ShowS)
-> Show DeleteDataSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDataSet] -> ShowS
$cshowList :: [DeleteDataSet] -> ShowS
show :: DeleteDataSet -> String
$cshow :: DeleteDataSet -> String
showsPrec :: Int -> DeleteDataSet -> ShowS
$cshowsPrec :: Int -> DeleteDataSet -> ShowS
Prelude.Show, (forall x. DeleteDataSet -> Rep DeleteDataSet x)
-> (forall x. Rep DeleteDataSet x -> DeleteDataSet)
-> Generic DeleteDataSet
forall x. Rep DeleteDataSet x -> DeleteDataSet
forall x. DeleteDataSet -> Rep DeleteDataSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDataSet x -> DeleteDataSet
$cfrom :: forall x. DeleteDataSet -> Rep DeleteDataSet x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDataSet' 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:
--
-- 'awsAccountId', 'deleteDataSet_awsAccountId' - The Amazon Web Services account ID.
--
-- 'dataSetId', 'deleteDataSet_dataSetId' - The ID for the dataset that you want to create. This ID is unique per
-- Amazon Web Services Region for each Amazon Web Services account.
newDeleteDataSet ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'dataSetId'
  Prelude.Text ->
  DeleteDataSet
newDeleteDataSet :: Text -> Text -> DeleteDataSet
newDeleteDataSet Text
pAwsAccountId_ Text
pDataSetId_ =
  DeleteDataSet' :: Text -> Text -> DeleteDataSet
DeleteDataSet'
    { $sel:awsAccountId:DeleteDataSet' :: Text
awsAccountId = Text
pAwsAccountId_,
      $sel:dataSetId:DeleteDataSet' :: Text
dataSetId = Text
pDataSetId_
    }

-- | The Amazon Web Services account ID.
deleteDataSet_awsAccountId :: Lens.Lens' DeleteDataSet Prelude.Text
deleteDataSet_awsAccountId :: (Text -> f Text) -> DeleteDataSet -> f DeleteDataSet
deleteDataSet_awsAccountId = (DeleteDataSet -> Text)
-> (DeleteDataSet -> Text -> DeleteDataSet)
-> Lens DeleteDataSet DeleteDataSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDataSet' {Text
awsAccountId :: Text
$sel:awsAccountId:DeleteDataSet' :: DeleteDataSet -> Text
awsAccountId} -> Text
awsAccountId) (\s :: DeleteDataSet
s@DeleteDataSet' {} Text
a -> DeleteDataSet
s {$sel:awsAccountId:DeleteDataSet' :: Text
awsAccountId = Text
a} :: DeleteDataSet)

-- | The ID for the dataset that you want to create. This ID is unique per
-- Amazon Web Services Region for each Amazon Web Services account.
deleteDataSet_dataSetId :: Lens.Lens' DeleteDataSet Prelude.Text
deleteDataSet_dataSetId :: (Text -> f Text) -> DeleteDataSet -> f DeleteDataSet
deleteDataSet_dataSetId = (DeleteDataSet -> Text)
-> (DeleteDataSet -> Text -> DeleteDataSet)
-> Lens DeleteDataSet DeleteDataSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDataSet' {Text
dataSetId :: Text
$sel:dataSetId:DeleteDataSet' :: DeleteDataSet -> Text
dataSetId} -> Text
dataSetId) (\s :: DeleteDataSet
s@DeleteDataSet' {} Text
a -> DeleteDataSet
s {$sel:dataSetId:DeleteDataSet' :: Text
dataSetId = Text
a} :: DeleteDataSet)

instance Core.AWSRequest DeleteDataSet where
  type
    AWSResponse DeleteDataSet =
      DeleteDataSetResponse
  request :: DeleteDataSet -> Request DeleteDataSet
request = Service -> DeleteDataSet -> Request DeleteDataSet
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDataSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDataSet)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteDataSet))
-> Logger
-> Service
-> Proxy DeleteDataSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDataSet)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Int -> DeleteDataSetResponse
DeleteDataSetResponse'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Int -> DeleteDataSetResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> DeleteDataSetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RequestId")
            Either
  String (Maybe Text -> Maybe Text -> Int -> DeleteDataSetResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> DeleteDataSetResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Arn")
            Either String (Maybe Text -> Int -> DeleteDataSetResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteDataSetResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DataSetId")
            Either String (Int -> DeleteDataSetResponse)
-> Either String Int -> Either String DeleteDataSetResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteDataSet

instance Prelude.NFData DeleteDataSet

instance Core.ToHeaders DeleteDataSet where
  toHeaders :: DeleteDataSet -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteDataSet -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DeleteDataSet where
  toPath :: DeleteDataSet -> ByteString
toPath DeleteDataSet' {Text
dataSetId :: Text
awsAccountId :: Text
$sel:dataSetId:DeleteDataSet' :: DeleteDataSet -> Text
$sel:awsAccountId:DeleteDataSet' :: DeleteDataSet -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
awsAccountId,
        ByteString
"/data-sets/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
dataSetId
      ]

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

-- | /See:/ 'newDeleteDataSetResponse' smart constructor.
data DeleteDataSetResponse = DeleteDataSetResponse'
  { -- | The Amazon Web Services request ID for this operation.
    DeleteDataSetResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the dataset.
    DeleteDataSetResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The ID for the dataset that you want to create. This ID is unique per
    -- Amazon Web Services Region for each Amazon Web Services account.
    DeleteDataSetResponse -> Maybe Text
dataSetId :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    DeleteDataSetResponse -> Int
status :: Prelude.Int
  }
  deriving (DeleteDataSetResponse -> DeleteDataSetResponse -> Bool
(DeleteDataSetResponse -> DeleteDataSetResponse -> Bool)
-> (DeleteDataSetResponse -> DeleteDataSetResponse -> Bool)
-> Eq DeleteDataSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDataSetResponse -> DeleteDataSetResponse -> Bool
$c/= :: DeleteDataSetResponse -> DeleteDataSetResponse -> Bool
== :: DeleteDataSetResponse -> DeleteDataSetResponse -> Bool
$c== :: DeleteDataSetResponse -> DeleteDataSetResponse -> Bool
Prelude.Eq, ReadPrec [DeleteDataSetResponse]
ReadPrec DeleteDataSetResponse
Int -> ReadS DeleteDataSetResponse
ReadS [DeleteDataSetResponse]
(Int -> ReadS DeleteDataSetResponse)
-> ReadS [DeleteDataSetResponse]
-> ReadPrec DeleteDataSetResponse
-> ReadPrec [DeleteDataSetResponse]
-> Read DeleteDataSetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDataSetResponse]
$creadListPrec :: ReadPrec [DeleteDataSetResponse]
readPrec :: ReadPrec DeleteDataSetResponse
$creadPrec :: ReadPrec DeleteDataSetResponse
readList :: ReadS [DeleteDataSetResponse]
$creadList :: ReadS [DeleteDataSetResponse]
readsPrec :: Int -> ReadS DeleteDataSetResponse
$creadsPrec :: Int -> ReadS DeleteDataSetResponse
Prelude.Read, Int -> DeleteDataSetResponse -> ShowS
[DeleteDataSetResponse] -> ShowS
DeleteDataSetResponse -> String
(Int -> DeleteDataSetResponse -> ShowS)
-> (DeleteDataSetResponse -> String)
-> ([DeleteDataSetResponse] -> ShowS)
-> Show DeleteDataSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDataSetResponse] -> ShowS
$cshowList :: [DeleteDataSetResponse] -> ShowS
show :: DeleteDataSetResponse -> String
$cshow :: DeleteDataSetResponse -> String
showsPrec :: Int -> DeleteDataSetResponse -> ShowS
$cshowsPrec :: Int -> DeleteDataSetResponse -> ShowS
Prelude.Show, (forall x. DeleteDataSetResponse -> Rep DeleteDataSetResponse x)
-> (forall x. Rep DeleteDataSetResponse x -> DeleteDataSetResponse)
-> Generic DeleteDataSetResponse
forall x. Rep DeleteDataSetResponse x -> DeleteDataSetResponse
forall x. DeleteDataSetResponse -> Rep DeleteDataSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDataSetResponse x -> DeleteDataSetResponse
$cfrom :: forall x. DeleteDataSetResponse -> Rep DeleteDataSetResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDataSetResponse' 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:
--
-- 'requestId', 'deleteDataSetResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'arn', 'deleteDataSetResponse_arn' - The Amazon Resource Name (ARN) of the dataset.
--
-- 'dataSetId', 'deleteDataSetResponse_dataSetId' - The ID for the dataset that you want to create. This ID is unique per
-- Amazon Web Services Region for each Amazon Web Services account.
--
-- 'status', 'deleteDataSetResponse_status' - The HTTP status of the request.
newDeleteDataSetResponse ::
  -- | 'status'
  Prelude.Int ->
  DeleteDataSetResponse
newDeleteDataSetResponse :: Int -> DeleteDataSetResponse
newDeleteDataSetResponse Int
pStatus_ =
  DeleteDataSetResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> DeleteDataSetResponse
DeleteDataSetResponse'
    { $sel:requestId:DeleteDataSetResponse' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DeleteDataSetResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSetId:DeleteDataSetResponse' :: Maybe Text
dataSetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DeleteDataSetResponse' :: Int
status = Int
pStatus_
    }

-- | The Amazon Web Services request ID for this operation.
deleteDataSetResponse_requestId :: Lens.Lens' DeleteDataSetResponse (Prelude.Maybe Prelude.Text)
deleteDataSetResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> DeleteDataSetResponse -> f DeleteDataSetResponse
deleteDataSetResponse_requestId = (DeleteDataSetResponse -> Maybe Text)
-> (DeleteDataSetResponse -> Maybe Text -> DeleteDataSetResponse)
-> Lens
     DeleteDataSetResponse
     DeleteDataSetResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDataSetResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:DeleteDataSetResponse' :: DeleteDataSetResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: DeleteDataSetResponse
s@DeleteDataSetResponse' {} Maybe Text
a -> DeleteDataSetResponse
s {$sel:requestId:DeleteDataSetResponse' :: Maybe Text
requestId = Maybe Text
a} :: DeleteDataSetResponse)

-- | The Amazon Resource Name (ARN) of the dataset.
deleteDataSetResponse_arn :: Lens.Lens' DeleteDataSetResponse (Prelude.Maybe Prelude.Text)
deleteDataSetResponse_arn :: (Maybe Text -> f (Maybe Text))
-> DeleteDataSetResponse -> f DeleteDataSetResponse
deleteDataSetResponse_arn = (DeleteDataSetResponse -> Maybe Text)
-> (DeleteDataSetResponse -> Maybe Text -> DeleteDataSetResponse)
-> Lens
     DeleteDataSetResponse
     DeleteDataSetResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDataSetResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:DeleteDataSetResponse' :: DeleteDataSetResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeleteDataSetResponse
s@DeleteDataSetResponse' {} Maybe Text
a -> DeleteDataSetResponse
s {$sel:arn:DeleteDataSetResponse' :: Maybe Text
arn = Maybe Text
a} :: DeleteDataSetResponse)

-- | The ID for the dataset that you want to create. This ID is unique per
-- Amazon Web Services Region for each Amazon Web Services account.
deleteDataSetResponse_dataSetId :: Lens.Lens' DeleteDataSetResponse (Prelude.Maybe Prelude.Text)
deleteDataSetResponse_dataSetId :: (Maybe Text -> f (Maybe Text))
-> DeleteDataSetResponse -> f DeleteDataSetResponse
deleteDataSetResponse_dataSetId = (DeleteDataSetResponse -> Maybe Text)
-> (DeleteDataSetResponse -> Maybe Text -> DeleteDataSetResponse)
-> Lens
     DeleteDataSetResponse
     DeleteDataSetResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDataSetResponse' {Maybe Text
dataSetId :: Maybe Text
$sel:dataSetId:DeleteDataSetResponse' :: DeleteDataSetResponse -> Maybe Text
dataSetId} -> Maybe Text
dataSetId) (\s :: DeleteDataSetResponse
s@DeleteDataSetResponse' {} Maybe Text
a -> DeleteDataSetResponse
s {$sel:dataSetId:DeleteDataSetResponse' :: Maybe Text
dataSetId = Maybe Text
a} :: DeleteDataSetResponse)

-- | The HTTP status of the request.
deleteDataSetResponse_status :: Lens.Lens' DeleteDataSetResponse Prelude.Int
deleteDataSetResponse_status :: (Int -> f Int) -> DeleteDataSetResponse -> f DeleteDataSetResponse
deleteDataSetResponse_status = (DeleteDataSetResponse -> Int)
-> (DeleteDataSetResponse -> Int -> DeleteDataSetResponse)
-> Lens DeleteDataSetResponse DeleteDataSetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDataSetResponse' {Int
status :: Int
$sel:status:DeleteDataSetResponse' :: DeleteDataSetResponse -> Int
status} -> Int
status) (\s :: DeleteDataSetResponse
s@DeleteDataSetResponse' {} Int
a -> DeleteDataSetResponse
s {$sel:status:DeleteDataSetResponse' :: Int
status = Int
a} :: DeleteDataSetResponse)

instance Prelude.NFData DeleteDataSetResponse