{-# 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-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 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_requestId,
    describeIngestionResponse_ingestion,
    describeIngestionResponse_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:/ '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
(DescribeIngestion -> DescribeIngestion -> Bool)
-> (DescribeIngestion -> DescribeIngestion -> Bool)
-> Eq DescribeIngestion
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]
(Int -> ReadS DescribeIngestion)
-> ReadS [DescribeIngestion]
-> ReadPrec DescribeIngestion
-> ReadPrec [DescribeIngestion]
-> Read 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
(Int -> DescribeIngestion -> ShowS)
-> (DescribeIngestion -> String)
-> ([DescribeIngestion] -> ShowS)
-> Show DescribeIngestion
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. DescribeIngestion -> Rep DescribeIngestion x)
-> (forall x. Rep DescribeIngestion x -> DescribeIngestion)
-> Generic DescribeIngestion
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' :: Text -> Text -> Text -> DescribeIngestion
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 :: (Text -> f Text) -> DescribeIngestion -> f DescribeIngestion
describeIngestion_awsAccountId = (DescribeIngestion -> Text)
-> (DescribeIngestion -> Text -> DescribeIngestion)
-> Lens DescribeIngestion DescribeIngestion Text Text
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 :: (Text -> f Text) -> DescribeIngestion -> f DescribeIngestion
describeIngestion_dataSetId = (DescribeIngestion -> Text)
-> (DescribeIngestion -> Text -> DescribeIngestion)
-> Lens DescribeIngestion DescribeIngestion Text Text
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 :: (Text -> f Text) -> DescribeIngestion -> f DescribeIngestion
describeIngestion_ingestionId = (DescribeIngestion -> Text)
-> (DescribeIngestion -> Text -> DescribeIngestion)
-> Lens DescribeIngestion DescribeIngestion Text Text
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 :: DescribeIngestion -> Request DescribeIngestion
request = Service -> DescribeIngestion -> Request DescribeIngestion
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeIngestion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeIngestion)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeIngestion))
-> Logger
-> Service
-> Proxy DescribeIngestion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeIngestion)))
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 Ingestion -> Int -> DescribeIngestionResponse
DescribeIngestionResponse'
            (Maybe Text -> Maybe Ingestion -> Int -> DescribeIngestionResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Ingestion -> Int -> DescribeIngestionResponse)
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 Ingestion -> Int -> DescribeIngestionResponse)
-> Either String (Maybe Ingestion)
-> Either String (Int -> DescribeIngestionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Ingestion)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Ingestion")
            Either String (Int -> DescribeIngestionResponse)
-> Either String Int -> Either String DescribeIngestionResponse
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 DescribeIngestion

instance Prelude.NFData DescribeIngestion

instance Core.ToHeaders DescribeIngestion where
  toHeaders :: DescribeIngestion -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeIngestion -> 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 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
..} =
    [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,
        ByteString
"/ingestions/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
ingestionId
      ]

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

-- | /See:/ 'newDescribeIngestionResponse' smart constructor.
data DescribeIngestionResponse = DescribeIngestionResponse'
  { -- | The Amazon Web Services request ID for this operation.
    DescribeIngestionResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | Information about the ingestion.
    DescribeIngestionResponse -> Maybe Ingestion
ingestion :: Prelude.Maybe Ingestion,
    -- | The HTTP status of the request.
    DescribeIngestionResponse -> Int
status :: Prelude.Int
  }
  deriving (DescribeIngestionResponse -> DescribeIngestionResponse -> Bool
(DescribeIngestionResponse -> DescribeIngestionResponse -> Bool)
-> (DescribeIngestionResponse -> DescribeIngestionResponse -> Bool)
-> Eq DescribeIngestionResponse
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]
(Int -> ReadS DescribeIngestionResponse)
-> ReadS [DescribeIngestionResponse]
-> ReadPrec DescribeIngestionResponse
-> ReadPrec [DescribeIngestionResponse]
-> Read 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
(Int -> DescribeIngestionResponse -> ShowS)
-> (DescribeIngestionResponse -> String)
-> ([DescribeIngestionResponse] -> ShowS)
-> Show DescribeIngestionResponse
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.
 DescribeIngestionResponse -> Rep DescribeIngestionResponse x)
-> (forall x.
    Rep DescribeIngestionResponse x -> DescribeIngestionResponse)
-> Generic DescribeIngestionResponse
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:
--
-- 'requestId', 'describeIngestionResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'ingestion', 'describeIngestionResponse_ingestion' - Information about the ingestion.
--
-- 'status', 'describeIngestionResponse_status' - The HTTP status of the request.
newDescribeIngestionResponse ::
  -- | 'status'
  Prelude.Int ->
  DescribeIngestionResponse
newDescribeIngestionResponse :: Int -> DescribeIngestionResponse
newDescribeIngestionResponse Int
pStatus_ =
  DescribeIngestionResponse' :: Maybe Text -> Maybe Ingestion -> Int -> DescribeIngestionResponse
DescribeIngestionResponse'
    { $sel:requestId:DescribeIngestionResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ingestion:DescribeIngestionResponse' :: Maybe Ingestion
ingestion = Maybe Ingestion
forall a. Maybe a
Prelude.Nothing,
      $sel:status:DescribeIngestionResponse' :: Int
status = Int
pStatus_
    }

-- | The Amazon Web Services request ID for this operation.
describeIngestionResponse_requestId :: Lens.Lens' DescribeIngestionResponse (Prelude.Maybe Prelude.Text)
describeIngestionResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> DescribeIngestionResponse -> f DescribeIngestionResponse
describeIngestionResponse_requestId = (DescribeIngestionResponse -> Maybe Text)
-> (DescribeIngestionResponse
    -> Maybe Text -> DescribeIngestionResponse)
-> Lens
     DescribeIngestionResponse
     DescribeIngestionResponse
     (Maybe Text)
     (Maybe Text)
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)

-- | Information about the ingestion.
describeIngestionResponse_ingestion :: Lens.Lens' DescribeIngestionResponse (Prelude.Maybe Ingestion)
describeIngestionResponse_ingestion :: (Maybe Ingestion -> f (Maybe Ingestion))
-> DescribeIngestionResponse -> f DescribeIngestionResponse
describeIngestionResponse_ingestion = (DescribeIngestionResponse -> Maybe Ingestion)
-> (DescribeIngestionResponse
    -> Maybe Ingestion -> DescribeIngestionResponse)
-> Lens
     DescribeIngestionResponse
     DescribeIngestionResponse
     (Maybe Ingestion)
     (Maybe 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 HTTP status of the request.
describeIngestionResponse_status :: Lens.Lens' DescribeIngestionResponse Prelude.Int
describeIngestionResponse_status :: (Int -> f Int)
-> DescribeIngestionResponse -> f DescribeIngestionResponse
describeIngestionResponse_status = (DescribeIngestionResponse -> Int)
-> (DescribeIngestionResponse -> Int -> DescribeIngestionResponse)
-> Lens DescribeIngestionResponse DescribeIngestionResponse Int Int
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