{-# 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.DescribeDataSet
-- 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)
--
-- Describes a dataset.
module Amazonka.QuickSight.DescribeDataSet
  ( -- * Creating a Request
    DescribeDataSet (..),
    newDescribeDataSet,

    -- * Request Lenses
    describeDataSet_awsAccountId,
    describeDataSet_dataSetId,

    -- * Destructuring the Response
    DescribeDataSetResponse (..),
    newDescribeDataSetResponse,

    -- * Response Lenses
    describeDataSetResponse_requestId,
    describeDataSetResponse_dataSet,
    describeDataSetResponse_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:/ 'newDescribeDataSet' smart constructor.
data DescribeDataSet = DescribeDataSet'
  { -- | The Amazon Web Services account ID.
    DescribeDataSet -> 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.
    DescribeDataSet -> Text
dataSetId :: Prelude.Text
  }
  deriving (DescribeDataSet -> DescribeDataSet -> Bool
(DescribeDataSet -> DescribeDataSet -> Bool)
-> (DescribeDataSet -> DescribeDataSet -> Bool)
-> Eq DescribeDataSet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDataSet -> DescribeDataSet -> Bool
$c/= :: DescribeDataSet -> DescribeDataSet -> Bool
== :: DescribeDataSet -> DescribeDataSet -> Bool
$c== :: DescribeDataSet -> DescribeDataSet -> Bool
Prelude.Eq, ReadPrec [DescribeDataSet]
ReadPrec DescribeDataSet
Int -> ReadS DescribeDataSet
ReadS [DescribeDataSet]
(Int -> ReadS DescribeDataSet)
-> ReadS [DescribeDataSet]
-> ReadPrec DescribeDataSet
-> ReadPrec [DescribeDataSet]
-> Read DescribeDataSet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDataSet]
$creadListPrec :: ReadPrec [DescribeDataSet]
readPrec :: ReadPrec DescribeDataSet
$creadPrec :: ReadPrec DescribeDataSet
readList :: ReadS [DescribeDataSet]
$creadList :: ReadS [DescribeDataSet]
readsPrec :: Int -> ReadS DescribeDataSet
$creadsPrec :: Int -> ReadS DescribeDataSet
Prelude.Read, Int -> DescribeDataSet -> ShowS
[DescribeDataSet] -> ShowS
DescribeDataSet -> String
(Int -> DescribeDataSet -> ShowS)
-> (DescribeDataSet -> String)
-> ([DescribeDataSet] -> ShowS)
-> Show DescribeDataSet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDataSet] -> ShowS
$cshowList :: [DescribeDataSet] -> ShowS
show :: DescribeDataSet -> String
$cshow :: DescribeDataSet -> String
showsPrec :: Int -> DescribeDataSet -> ShowS
$cshowsPrec :: Int -> DescribeDataSet -> ShowS
Prelude.Show, (forall x. DescribeDataSet -> Rep DescribeDataSet x)
-> (forall x. Rep DescribeDataSet x -> DescribeDataSet)
-> Generic DescribeDataSet
forall x. Rep DescribeDataSet x -> DescribeDataSet
forall x. DescribeDataSet -> Rep DescribeDataSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDataSet x -> DescribeDataSet
$cfrom :: forall x. DescribeDataSet -> Rep DescribeDataSet x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDataSet' 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', 'describeDataSet_awsAccountId' - The Amazon Web Services account ID.
--
-- 'dataSetId', 'describeDataSet_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.
newDescribeDataSet ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'dataSetId'
  Prelude.Text ->
  DescribeDataSet
newDescribeDataSet :: Text -> Text -> DescribeDataSet
newDescribeDataSet Text
pAwsAccountId_ Text
pDataSetId_ =
  DescribeDataSet' :: Text -> Text -> DescribeDataSet
DescribeDataSet'
    { $sel:awsAccountId:DescribeDataSet' :: Text
awsAccountId = Text
pAwsAccountId_,
      $sel:dataSetId:DescribeDataSet' :: Text
dataSetId = Text
pDataSetId_
    }

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

-- | 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.
describeDataSet_dataSetId :: Lens.Lens' DescribeDataSet Prelude.Text
describeDataSet_dataSetId :: (Text -> f Text) -> DescribeDataSet -> f DescribeDataSet
describeDataSet_dataSetId = (DescribeDataSet -> Text)
-> (DescribeDataSet -> Text -> DescribeDataSet)
-> Lens DescribeDataSet DescribeDataSet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataSet' {Text
dataSetId :: Text
$sel:dataSetId:DescribeDataSet' :: DescribeDataSet -> Text
dataSetId} -> Text
dataSetId) (\s :: DescribeDataSet
s@DescribeDataSet' {} Text
a -> DescribeDataSet
s {$sel:dataSetId:DescribeDataSet' :: Text
dataSetId = Text
a} :: DescribeDataSet)

instance Core.AWSRequest DescribeDataSet where
  type
    AWSResponse DescribeDataSet =
      DescribeDataSetResponse
  request :: DescribeDataSet -> Request DescribeDataSet
request = Service -> DescribeDataSet -> Request DescribeDataSet
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeDataSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeDataSet)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeDataSet))
-> Logger
-> Service
-> Proxy DescribeDataSet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeDataSet)))
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 DataSet -> Int -> DescribeDataSetResponse
DescribeDataSetResponse'
            (Maybe Text -> Maybe DataSet -> Int -> DescribeDataSetResponse)
-> Either String (Maybe Text)
-> Either String (Maybe DataSet -> Int -> DescribeDataSetResponse)
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 DataSet -> Int -> DescribeDataSetResponse)
-> Either String (Maybe DataSet)
-> Either String (Int -> DescribeDataSetResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe DataSet)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DataSet")
            Either String (Int -> DescribeDataSetResponse)
-> Either String Int -> Either String DescribeDataSetResponse
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 DescribeDataSet

instance Prelude.NFData DescribeDataSet

instance Core.ToHeaders DescribeDataSet where
  toHeaders :: DescribeDataSet -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeDataSet -> 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 DescribeDataSet where
  toPath :: DescribeDataSet -> ByteString
toPath DescribeDataSet' {Text
dataSetId :: Text
awsAccountId :: Text
$sel:dataSetId:DescribeDataSet' :: DescribeDataSet -> Text
$sel:awsAccountId:DescribeDataSet' :: DescribeDataSet -> 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 DescribeDataSet where
  toQuery :: DescribeDataSet -> QueryString
toQuery = QueryString -> DescribeDataSet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeDataSetResponse' smart constructor.
data DescribeDataSetResponse = DescribeDataSetResponse'
  { -- | The Amazon Web Services request ID for this operation.
    DescribeDataSetResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | Information on the dataset.
    DescribeDataSetResponse -> Maybe DataSet
dataSet :: Prelude.Maybe DataSet,
    -- | The HTTP status of the request.
    DescribeDataSetResponse -> Int
status :: Prelude.Int
  }
  deriving (DescribeDataSetResponse -> DescribeDataSetResponse -> Bool
(DescribeDataSetResponse -> DescribeDataSetResponse -> Bool)
-> (DescribeDataSetResponse -> DescribeDataSetResponse -> Bool)
-> Eq DescribeDataSetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDataSetResponse -> DescribeDataSetResponse -> Bool
$c/= :: DescribeDataSetResponse -> DescribeDataSetResponse -> Bool
== :: DescribeDataSetResponse -> DescribeDataSetResponse -> Bool
$c== :: DescribeDataSetResponse -> DescribeDataSetResponse -> Bool
Prelude.Eq, Int -> DescribeDataSetResponse -> ShowS
[DescribeDataSetResponse] -> ShowS
DescribeDataSetResponse -> String
(Int -> DescribeDataSetResponse -> ShowS)
-> (DescribeDataSetResponse -> String)
-> ([DescribeDataSetResponse] -> ShowS)
-> Show DescribeDataSetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDataSetResponse] -> ShowS
$cshowList :: [DescribeDataSetResponse] -> ShowS
show :: DescribeDataSetResponse -> String
$cshow :: DescribeDataSetResponse -> String
showsPrec :: Int -> DescribeDataSetResponse -> ShowS
$cshowsPrec :: Int -> DescribeDataSetResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDataSetResponse -> Rep DescribeDataSetResponse x)
-> (forall x.
    Rep DescribeDataSetResponse x -> DescribeDataSetResponse)
-> Generic DescribeDataSetResponse
forall x. Rep DescribeDataSetResponse x -> DescribeDataSetResponse
forall x. DescribeDataSetResponse -> Rep DescribeDataSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDataSetResponse x -> DescribeDataSetResponse
$cfrom :: forall x. DescribeDataSetResponse -> Rep DescribeDataSetResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDataSetResponse' 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', 'describeDataSetResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'dataSet', 'describeDataSetResponse_dataSet' - Information on the dataset.
--
-- 'status', 'describeDataSetResponse_status' - The HTTP status of the request.
newDescribeDataSetResponse ::
  -- | 'status'
  Prelude.Int ->
  DescribeDataSetResponse
newDescribeDataSetResponse :: Int -> DescribeDataSetResponse
newDescribeDataSetResponse Int
pStatus_ =
  DescribeDataSetResponse' :: Maybe Text -> Maybe DataSet -> Int -> DescribeDataSetResponse
DescribeDataSetResponse'
    { $sel:requestId:DescribeDataSetResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dataSet:DescribeDataSetResponse' :: Maybe DataSet
dataSet = Maybe DataSet
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DescribeDataSetResponse' :: Int
status = Int
pStatus_
    }

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

-- | Information on the dataset.
describeDataSetResponse_dataSet :: Lens.Lens' DescribeDataSetResponse (Prelude.Maybe DataSet)
describeDataSetResponse_dataSet :: (Maybe DataSet -> f (Maybe DataSet))
-> DescribeDataSetResponse -> f DescribeDataSetResponse
describeDataSetResponse_dataSet = (DescribeDataSetResponse -> Maybe DataSet)
-> (DescribeDataSetResponse
    -> Maybe DataSet -> DescribeDataSetResponse)
-> Lens
     DescribeDataSetResponse
     DescribeDataSetResponse
     (Maybe DataSet)
     (Maybe DataSet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDataSetResponse' {Maybe DataSet
dataSet :: Maybe DataSet
$sel:dataSet:DescribeDataSetResponse' :: DescribeDataSetResponse -> Maybe DataSet
dataSet} -> Maybe DataSet
dataSet) (\s :: DescribeDataSetResponse
s@DescribeDataSetResponse' {} Maybe DataSet
a -> DescribeDataSetResponse
s {$sel:dataSet:DescribeDataSetResponse' :: Maybe DataSet
dataSet = Maybe DataSet
a} :: DescribeDataSetResponse)

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

instance Prelude.NFData DescribeDataSetResponse