{-# 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.DescribeIngestion
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes a SPICE ingestion.
module Amazonka.QuickSight.DescribeIngestion
  ( -- * Creating a Request
    DescribeIngestion (..),
    newDescribeIngestion,

    -- * Request Lenses
    describeIngestion_awsAccountId,
    describeIngestion_dataSetId,
    describeIngestion_ingestionId,

    -- * Destructuring the Response
    DescribeIngestionResponse (..),
    newDescribeIngestionResponse,

    -- * Response Lenses
    describeIngestionResponse_ingestion,
    describeIngestionResponse_requestId,
    describeIngestionResponse_status,
  )
where

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

-- | /See:/ 'newDescribeIngestion' smart constructor.
data DescribeIngestion = DescribeIngestion'
  { -- | The Amazon Web Services account ID.
    DescribeIngestion -> Text
awsAccountId :: Prelude.Text,
    -- | The ID of the dataset used in the ingestion.
    DescribeIngestion -> Text
dataSetId :: Prelude.Text,
    -- | An ID for the ingestion.
    DescribeIngestion -> Text
ingestionId :: Prelude.Text
  }
  deriving (DescribeIngestion -> DescribeIngestion -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeIngestion -> DescribeIngestion -> Bool
$c/= :: DescribeIngestion -> DescribeIngestion -> Bool
== :: DescribeIngestion -> DescribeIngestion -> Bool
$c== :: DescribeIngestion -> DescribeIngestion -> Bool
Prelude.Eq, ReadPrec [DescribeIngestion]
ReadPrec DescribeIngestion
Int -> ReadS DescribeIngestion
ReadS [DescribeIngestion]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeIngestion]
$creadListPrec :: ReadPrec [DescribeIngestion]
readPrec :: ReadPrec DescribeIngestion
$creadPrec :: ReadPrec DescribeIngestion
readList :: ReadS [DescribeIngestion]
$creadList :: ReadS [DescribeIngestion]
readsPrec :: Int -> ReadS DescribeIngestion
$creadsPrec :: Int -> ReadS DescribeIngestion
Prelude.Read, Int -> DescribeIngestion -> ShowS
[DescribeIngestion] -> ShowS
DescribeIngestion -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeIngestion] -> ShowS
$cshowList :: [DescribeIngestion] -> ShowS
show :: DescribeIngestion -> String
$cshow :: DescribeIngestion -> String
showsPrec :: Int -> DescribeIngestion -> ShowS
$cshowsPrec :: Int -> DescribeIngestion -> ShowS
Prelude.Show, forall x. Rep DescribeIngestion x -> DescribeIngestion
forall x. DescribeIngestion -> Rep DescribeIngestion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeIngestion x -> DescribeIngestion
$cfrom :: forall x. DescribeIngestion -> Rep DescribeIngestion x
Prelude.Generic)

-- |
-- Create a value of 'DescribeIngestion' 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', 'describeIngestion_awsAccountId' - The Amazon Web Services account ID.
--
-- 'dataSetId', 'describeIngestion_dataSetId' - The ID of the dataset used in the ingestion.
--
-- 'ingestionId', 'describeIngestion_ingestionId' - An ID for the ingestion.
newDescribeIngestion ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'dataSetId'
  Prelude.Text ->
  -- | 'ingestionId'
  Prelude.Text ->
  DescribeIngestion
newDescribeIngestion :: Text -> Text -> Text -> DescribeIngestion
newDescribeIngestion
  Text
pAwsAccountId_
  Text
pDataSetId_
  Text
pIngestionId_ =
    DescribeIngestion'
      { $sel:awsAccountId:DescribeIngestion' :: Text
awsAccountId = Text
pAwsAccountId_,
        $sel:dataSetId:DescribeIngestion' :: Text
dataSetId = Text
pDataSetId_,
        $sel:ingestionId:DescribeIngestion' :: Text
ingestionId = Text
pIngestionId_
      }

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

-- | The ID of the dataset used in the ingestion.
describeIngestion_dataSetId :: Lens.Lens' DescribeIngestion Prelude.Text
describeIngestion_dataSetId :: Lens' DescribeIngestion Text
describeIngestion_dataSetId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeIngestion' {Text
dataSetId :: Text
$sel:dataSetId:DescribeIngestion' :: DescribeIngestion -> Text
dataSetId} -> Text
dataSetId) (\s :: DescribeIngestion
s@DescribeIngestion' {} Text
a -> DescribeIngestion
s {$sel:dataSetId:DescribeIngestion' :: Text
dataSetId = Text
a} :: DescribeIngestion)

-- | An ID for the ingestion.
describeIngestion_ingestionId :: Lens.Lens' DescribeIngestion Prelude.Text
describeIngestion_ingestionId :: Lens' DescribeIngestion Text
describeIngestion_ingestionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeIngestion' {Text
ingestionId :: Text
$sel:ingestionId:DescribeIngestion' :: DescribeIngestion -> Text
ingestionId} -> Text
ingestionId) (\s :: DescribeIngestion
s@DescribeIngestion' {} Text
a -> DescribeIngestion
s {$sel:ingestionId:DescribeIngestion' :: Text
ingestionId = Text
a} :: DescribeIngestion)

instance Core.AWSRequest DescribeIngestion where
  type
    AWSResponse DescribeIngestion =
      DescribeIngestionResponse
  request :: (Service -> Service)
-> DescribeIngestion -> Request DescribeIngestion
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeIngestion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeIngestion)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Ingestion -> Maybe Text -> Int -> DescribeIngestionResponse
DescribeIngestionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Ingestion")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"RequestId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeIngestion where
  hashWithSalt :: Int -> DescribeIngestion -> Int
hashWithSalt Int
_salt DescribeIngestion' {Text
ingestionId :: Text
dataSetId :: Text
awsAccountId :: Text
$sel:ingestionId:DescribeIngestion' :: DescribeIngestion -> Text
$sel:dataSetId:DescribeIngestion' :: DescribeIngestion -> Text
$sel:awsAccountId:DescribeIngestion' :: DescribeIngestion -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
awsAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dataSetId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ingestionId

instance Prelude.NFData DescribeIngestion where
  rnf :: DescribeIngestion -> ()
rnf DescribeIngestion' {Text
ingestionId :: Text
dataSetId :: Text
awsAccountId :: Text
$sel:ingestionId:DescribeIngestion' :: DescribeIngestion -> Text
$sel:dataSetId:DescribeIngestion' :: DescribeIngestion -> Text
$sel:awsAccountId:DescribeIngestion' :: DescribeIngestion -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
awsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dataSetId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ingestionId

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

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

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

-- | /See:/ 'newDescribeIngestionResponse' smart constructor.
data DescribeIngestionResponse = DescribeIngestionResponse'
  { -- | Information about the ingestion.
    DescribeIngestionResponse -> Maybe Ingestion
ingestion :: Prelude.Maybe Ingestion,
    -- | The Amazon Web Services request ID for this operation.
    DescribeIngestionResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The HTTP status of the request.
    DescribeIngestionResponse -> Int
status :: Prelude.Int
  }
  deriving (DescribeIngestionResponse -> DescribeIngestionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeIngestionResponse -> DescribeIngestionResponse -> Bool
$c/= :: DescribeIngestionResponse -> DescribeIngestionResponse -> Bool
== :: DescribeIngestionResponse -> DescribeIngestionResponse -> Bool
$c== :: DescribeIngestionResponse -> DescribeIngestionResponse -> Bool
Prelude.Eq, ReadPrec [DescribeIngestionResponse]
ReadPrec DescribeIngestionResponse
Int -> ReadS DescribeIngestionResponse
ReadS [DescribeIngestionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeIngestionResponse]
$creadListPrec :: ReadPrec [DescribeIngestionResponse]
readPrec :: ReadPrec DescribeIngestionResponse
$creadPrec :: ReadPrec DescribeIngestionResponse
readList :: ReadS [DescribeIngestionResponse]
$creadList :: ReadS [DescribeIngestionResponse]
readsPrec :: Int -> ReadS DescribeIngestionResponse
$creadsPrec :: Int -> ReadS DescribeIngestionResponse
Prelude.Read, Int -> DescribeIngestionResponse -> ShowS
[DescribeIngestionResponse] -> ShowS
DescribeIngestionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeIngestionResponse] -> ShowS
$cshowList :: [DescribeIngestionResponse] -> ShowS
show :: DescribeIngestionResponse -> String
$cshow :: DescribeIngestionResponse -> String
showsPrec :: Int -> DescribeIngestionResponse -> ShowS
$cshowsPrec :: Int -> DescribeIngestionResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeIngestionResponse x -> DescribeIngestionResponse
forall x.
DescribeIngestionResponse -> Rep DescribeIngestionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeIngestionResponse x -> DescribeIngestionResponse
$cfrom :: forall x.
DescribeIngestionResponse -> Rep DescribeIngestionResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeIngestionResponse' 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:
--
-- 'ingestion', 'describeIngestionResponse_ingestion' - Information about the ingestion.
--
-- 'requestId', 'describeIngestionResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'status', 'describeIngestionResponse_status' - The HTTP status of the request.
newDescribeIngestionResponse ::
  -- | 'status'
  Prelude.Int ->
  DescribeIngestionResponse
newDescribeIngestionResponse :: Int -> DescribeIngestionResponse
newDescribeIngestionResponse Int
pStatus_ =
  DescribeIngestionResponse'
    { $sel:ingestion:DescribeIngestionResponse' :: Maybe Ingestion
ingestion =
        forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:DescribeIngestionResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:status:DescribeIngestionResponse' :: Int
status = Int
pStatus_
    }

-- | Information about the ingestion.
describeIngestionResponse_ingestion :: Lens.Lens' DescribeIngestionResponse (Prelude.Maybe Ingestion)
describeIngestionResponse_ingestion :: Lens' DescribeIngestionResponse (Maybe Ingestion)
describeIngestionResponse_ingestion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeIngestionResponse' {Maybe Ingestion
ingestion :: Maybe Ingestion
$sel:ingestion:DescribeIngestionResponse' :: DescribeIngestionResponse -> Maybe Ingestion
ingestion} -> Maybe Ingestion
ingestion) (\s :: DescribeIngestionResponse
s@DescribeIngestionResponse' {} Maybe Ingestion
a -> DescribeIngestionResponse
s {$sel:ingestion:DescribeIngestionResponse' :: Maybe Ingestion
ingestion = Maybe Ingestion
a} :: DescribeIngestionResponse)

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

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

instance Prelude.NFData DescribeIngestionResponse where
  rnf :: DescribeIngestionResponse -> ()
rnf DescribeIngestionResponse' {Int
Maybe Text
Maybe Ingestion
status :: Int
requestId :: Maybe Text
ingestion :: Maybe Ingestion
$sel:status:DescribeIngestionResponse' :: DescribeIngestionResponse -> Int
$sel:requestId:DescribeIngestionResponse' :: DescribeIngestionResponse -> Maybe Text
$sel:ingestion:DescribeIngestionResponse' :: DescribeIngestionResponse -> Maybe Ingestion
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Ingestion
ingestion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
status