{-# 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.QLDB.DescribeJournalS3Export
-- 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)
--
-- Returns information about a journal export job, including the ledger
-- name, export ID, creation time, current status, and the parameters of
-- the original export creation request.
--
-- This action does not return any expired export jobs. For more
-- information, see
-- <https://docs.aws.amazon.com/qldb/latest/developerguide/export-journal.request.html#export-journal.request.expiration Export job expiration>
-- in the /Amazon QLDB Developer Guide/.
--
-- If the export job with the given @ExportId@ doesn\'t exist, then throws
-- @ResourceNotFoundException@.
--
-- If the ledger with the given @Name@ doesn\'t exist, then throws
-- @ResourceNotFoundException@.
module Amazonka.QLDB.DescribeJournalS3Export
  ( -- * Creating a Request
    DescribeJournalS3Export (..),
    newDescribeJournalS3Export,

    -- * Request Lenses
    describeJournalS3Export_name,
    describeJournalS3Export_exportId,

    -- * Destructuring the Response
    DescribeJournalS3ExportResponse (..),
    newDescribeJournalS3ExportResponse,

    -- * Response Lenses
    describeJournalS3ExportResponse_httpStatus,
    describeJournalS3ExportResponse_exportDescription,
  )
where

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

-- | /See:/ 'newDescribeJournalS3Export' smart constructor.
data DescribeJournalS3Export = DescribeJournalS3Export'
  { -- | The name of the ledger.
    DescribeJournalS3Export -> Text
name :: Prelude.Text,
    -- | The UUID (represented in Base62-encoded text) of the journal export job
    -- to describe.
    DescribeJournalS3Export -> Text
exportId :: Prelude.Text
  }
  deriving (DescribeJournalS3Export -> DescribeJournalS3Export -> Bool
(DescribeJournalS3Export -> DescribeJournalS3Export -> Bool)
-> (DescribeJournalS3Export -> DescribeJournalS3Export -> Bool)
-> Eq DescribeJournalS3Export
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJournalS3Export -> DescribeJournalS3Export -> Bool
$c/= :: DescribeJournalS3Export -> DescribeJournalS3Export -> Bool
== :: DescribeJournalS3Export -> DescribeJournalS3Export -> Bool
$c== :: DescribeJournalS3Export -> DescribeJournalS3Export -> Bool
Prelude.Eq, ReadPrec [DescribeJournalS3Export]
ReadPrec DescribeJournalS3Export
Int -> ReadS DescribeJournalS3Export
ReadS [DescribeJournalS3Export]
(Int -> ReadS DescribeJournalS3Export)
-> ReadS [DescribeJournalS3Export]
-> ReadPrec DescribeJournalS3Export
-> ReadPrec [DescribeJournalS3Export]
-> Read DescribeJournalS3Export
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJournalS3Export]
$creadListPrec :: ReadPrec [DescribeJournalS3Export]
readPrec :: ReadPrec DescribeJournalS3Export
$creadPrec :: ReadPrec DescribeJournalS3Export
readList :: ReadS [DescribeJournalS3Export]
$creadList :: ReadS [DescribeJournalS3Export]
readsPrec :: Int -> ReadS DescribeJournalS3Export
$creadsPrec :: Int -> ReadS DescribeJournalS3Export
Prelude.Read, Int -> DescribeJournalS3Export -> ShowS
[DescribeJournalS3Export] -> ShowS
DescribeJournalS3Export -> String
(Int -> DescribeJournalS3Export -> ShowS)
-> (DescribeJournalS3Export -> String)
-> ([DescribeJournalS3Export] -> ShowS)
-> Show DescribeJournalS3Export
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJournalS3Export] -> ShowS
$cshowList :: [DescribeJournalS3Export] -> ShowS
show :: DescribeJournalS3Export -> String
$cshow :: DescribeJournalS3Export -> String
showsPrec :: Int -> DescribeJournalS3Export -> ShowS
$cshowsPrec :: Int -> DescribeJournalS3Export -> ShowS
Prelude.Show, (forall x.
 DescribeJournalS3Export -> Rep DescribeJournalS3Export x)
-> (forall x.
    Rep DescribeJournalS3Export x -> DescribeJournalS3Export)
-> Generic DescribeJournalS3Export
forall x. Rep DescribeJournalS3Export x -> DescribeJournalS3Export
forall x. DescribeJournalS3Export -> Rep DescribeJournalS3Export x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeJournalS3Export x -> DescribeJournalS3Export
$cfrom :: forall x. DescribeJournalS3Export -> Rep DescribeJournalS3Export x
Prelude.Generic)

-- |
-- Create a value of 'DescribeJournalS3Export' 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:
--
-- 'name', 'describeJournalS3Export_name' - The name of the ledger.
--
-- 'exportId', 'describeJournalS3Export_exportId' - The UUID (represented in Base62-encoded text) of the journal export job
-- to describe.
newDescribeJournalS3Export ::
  -- | 'name'
  Prelude.Text ->
  -- | 'exportId'
  Prelude.Text ->
  DescribeJournalS3Export
newDescribeJournalS3Export :: Text -> Text -> DescribeJournalS3Export
newDescribeJournalS3Export Text
pName_ Text
pExportId_ =
  DescribeJournalS3Export' :: Text -> Text -> DescribeJournalS3Export
DescribeJournalS3Export'
    { $sel:name:DescribeJournalS3Export' :: Text
name = Text
pName_,
      $sel:exportId:DescribeJournalS3Export' :: Text
exportId = Text
pExportId_
    }

-- | The name of the ledger.
describeJournalS3Export_name :: Lens.Lens' DescribeJournalS3Export Prelude.Text
describeJournalS3Export_name :: (Text -> f Text)
-> DescribeJournalS3Export -> f DescribeJournalS3Export
describeJournalS3Export_name = (DescribeJournalS3Export -> Text)
-> (DescribeJournalS3Export -> Text -> DescribeJournalS3Export)
-> Lens DescribeJournalS3Export DescribeJournalS3Export Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJournalS3Export' {Text
name :: Text
$sel:name:DescribeJournalS3Export' :: DescribeJournalS3Export -> Text
name} -> Text
name) (\s :: DescribeJournalS3Export
s@DescribeJournalS3Export' {} Text
a -> DescribeJournalS3Export
s {$sel:name:DescribeJournalS3Export' :: Text
name = Text
a} :: DescribeJournalS3Export)

-- | The UUID (represented in Base62-encoded text) of the journal export job
-- to describe.
describeJournalS3Export_exportId :: Lens.Lens' DescribeJournalS3Export Prelude.Text
describeJournalS3Export_exportId :: (Text -> f Text)
-> DescribeJournalS3Export -> f DescribeJournalS3Export
describeJournalS3Export_exportId = (DescribeJournalS3Export -> Text)
-> (DescribeJournalS3Export -> Text -> DescribeJournalS3Export)
-> Lens DescribeJournalS3Export DescribeJournalS3Export Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJournalS3Export' {Text
exportId :: Text
$sel:exportId:DescribeJournalS3Export' :: DescribeJournalS3Export -> Text
exportId} -> Text
exportId) (\s :: DescribeJournalS3Export
s@DescribeJournalS3Export' {} Text
a -> DescribeJournalS3Export
s {$sel:exportId:DescribeJournalS3Export' :: Text
exportId = Text
a} :: DescribeJournalS3Export)

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

instance Prelude.Hashable DescribeJournalS3Export

instance Prelude.NFData DescribeJournalS3Export

instance Core.ToHeaders DescribeJournalS3Export where
  toHeaders :: DescribeJournalS3Export -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeJournalS3Export -> 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 DescribeJournalS3Export where
  toPath :: DescribeJournalS3Export -> ByteString
toPath DescribeJournalS3Export' {Text
exportId :: Text
name :: Text
$sel:exportId:DescribeJournalS3Export' :: DescribeJournalS3Export -> Text
$sel:name:DescribeJournalS3Export' :: DescribeJournalS3Export -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/ledgers/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name,
        ByteString
"/journal-s3-exports/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
exportId
      ]

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

-- | /See:/ 'newDescribeJournalS3ExportResponse' smart constructor.
data DescribeJournalS3ExportResponse = DescribeJournalS3ExportResponse'
  { -- | The response's http status code.
    DescribeJournalS3ExportResponse -> Int
httpStatus :: Prelude.Int,
    -- | Information about the journal export job returned by a
    -- @DescribeJournalS3Export@ request.
    DescribeJournalS3ExportResponse -> JournalS3ExportDescription
exportDescription :: JournalS3ExportDescription
  }
  deriving (DescribeJournalS3ExportResponse
-> DescribeJournalS3ExportResponse -> Bool
(DescribeJournalS3ExportResponse
 -> DescribeJournalS3ExportResponse -> Bool)
-> (DescribeJournalS3ExportResponse
    -> DescribeJournalS3ExportResponse -> Bool)
-> Eq DescribeJournalS3ExportResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeJournalS3ExportResponse
-> DescribeJournalS3ExportResponse -> Bool
$c/= :: DescribeJournalS3ExportResponse
-> DescribeJournalS3ExportResponse -> Bool
== :: DescribeJournalS3ExportResponse
-> DescribeJournalS3ExportResponse -> Bool
$c== :: DescribeJournalS3ExportResponse
-> DescribeJournalS3ExportResponse -> Bool
Prelude.Eq, ReadPrec [DescribeJournalS3ExportResponse]
ReadPrec DescribeJournalS3ExportResponse
Int -> ReadS DescribeJournalS3ExportResponse
ReadS [DescribeJournalS3ExportResponse]
(Int -> ReadS DescribeJournalS3ExportResponse)
-> ReadS [DescribeJournalS3ExportResponse]
-> ReadPrec DescribeJournalS3ExportResponse
-> ReadPrec [DescribeJournalS3ExportResponse]
-> Read DescribeJournalS3ExportResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeJournalS3ExportResponse]
$creadListPrec :: ReadPrec [DescribeJournalS3ExportResponse]
readPrec :: ReadPrec DescribeJournalS3ExportResponse
$creadPrec :: ReadPrec DescribeJournalS3ExportResponse
readList :: ReadS [DescribeJournalS3ExportResponse]
$creadList :: ReadS [DescribeJournalS3ExportResponse]
readsPrec :: Int -> ReadS DescribeJournalS3ExportResponse
$creadsPrec :: Int -> ReadS DescribeJournalS3ExportResponse
Prelude.Read, Int -> DescribeJournalS3ExportResponse -> ShowS
[DescribeJournalS3ExportResponse] -> ShowS
DescribeJournalS3ExportResponse -> String
(Int -> DescribeJournalS3ExportResponse -> ShowS)
-> (DescribeJournalS3ExportResponse -> String)
-> ([DescribeJournalS3ExportResponse] -> ShowS)
-> Show DescribeJournalS3ExportResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeJournalS3ExportResponse] -> ShowS
$cshowList :: [DescribeJournalS3ExportResponse] -> ShowS
show :: DescribeJournalS3ExportResponse -> String
$cshow :: DescribeJournalS3ExportResponse -> String
showsPrec :: Int -> DescribeJournalS3ExportResponse -> ShowS
$cshowsPrec :: Int -> DescribeJournalS3ExportResponse -> ShowS
Prelude.Show, (forall x.
 DescribeJournalS3ExportResponse
 -> Rep DescribeJournalS3ExportResponse x)
-> (forall x.
    Rep DescribeJournalS3ExportResponse x
    -> DescribeJournalS3ExportResponse)
-> Generic DescribeJournalS3ExportResponse
forall x.
Rep DescribeJournalS3ExportResponse x
-> DescribeJournalS3ExportResponse
forall x.
DescribeJournalS3ExportResponse
-> Rep DescribeJournalS3ExportResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeJournalS3ExportResponse x
-> DescribeJournalS3ExportResponse
$cfrom :: forall x.
DescribeJournalS3ExportResponse
-> Rep DescribeJournalS3ExportResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeJournalS3ExportResponse' 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:
--
-- 'httpStatus', 'describeJournalS3ExportResponse_httpStatus' - The response's http status code.
--
-- 'exportDescription', 'describeJournalS3ExportResponse_exportDescription' - Information about the journal export job returned by a
-- @DescribeJournalS3Export@ request.
newDescribeJournalS3ExportResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'exportDescription'
  JournalS3ExportDescription ->
  DescribeJournalS3ExportResponse
newDescribeJournalS3ExportResponse :: Int
-> JournalS3ExportDescription -> DescribeJournalS3ExportResponse
newDescribeJournalS3ExportResponse
  Int
pHttpStatus_
  JournalS3ExportDescription
pExportDescription_ =
    DescribeJournalS3ExportResponse' :: Int
-> JournalS3ExportDescription -> DescribeJournalS3ExportResponse
DescribeJournalS3ExportResponse'
      { $sel:httpStatus:DescribeJournalS3ExportResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:exportDescription:DescribeJournalS3ExportResponse' :: JournalS3ExportDescription
exportDescription = JournalS3ExportDescription
pExportDescription_
      }

-- | The response's http status code.
describeJournalS3ExportResponse_httpStatus :: Lens.Lens' DescribeJournalS3ExportResponse Prelude.Int
describeJournalS3ExportResponse_httpStatus :: (Int -> f Int)
-> DescribeJournalS3ExportResponse
-> f DescribeJournalS3ExportResponse
describeJournalS3ExportResponse_httpStatus = (DescribeJournalS3ExportResponse -> Int)
-> (DescribeJournalS3ExportResponse
    -> Int -> DescribeJournalS3ExportResponse)
-> Lens
     DescribeJournalS3ExportResponse
     DescribeJournalS3ExportResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJournalS3ExportResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeJournalS3ExportResponse' :: DescribeJournalS3ExportResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeJournalS3ExportResponse
s@DescribeJournalS3ExportResponse' {} Int
a -> DescribeJournalS3ExportResponse
s {$sel:httpStatus:DescribeJournalS3ExportResponse' :: Int
httpStatus = Int
a} :: DescribeJournalS3ExportResponse)

-- | Information about the journal export job returned by a
-- @DescribeJournalS3Export@ request.
describeJournalS3ExportResponse_exportDescription :: Lens.Lens' DescribeJournalS3ExportResponse JournalS3ExportDescription
describeJournalS3ExportResponse_exportDescription :: (JournalS3ExportDescription -> f JournalS3ExportDescription)
-> DescribeJournalS3ExportResponse
-> f DescribeJournalS3ExportResponse
describeJournalS3ExportResponse_exportDescription = (DescribeJournalS3ExportResponse -> JournalS3ExportDescription)
-> (DescribeJournalS3ExportResponse
    -> JournalS3ExportDescription -> DescribeJournalS3ExportResponse)
-> Lens
     DescribeJournalS3ExportResponse
     DescribeJournalS3ExportResponse
     JournalS3ExportDescription
     JournalS3ExportDescription
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeJournalS3ExportResponse' {JournalS3ExportDescription
exportDescription :: JournalS3ExportDescription
$sel:exportDescription:DescribeJournalS3ExportResponse' :: DescribeJournalS3ExportResponse -> JournalS3ExportDescription
exportDescription} -> JournalS3ExportDescription
exportDescription) (\s :: DescribeJournalS3ExportResponse
s@DescribeJournalS3ExportResponse' {} JournalS3ExportDescription
a -> DescribeJournalS3ExportResponse
s {$sel:exportDescription:DescribeJournalS3ExportResponse' :: JournalS3ExportDescription
exportDescription = JournalS3ExportDescription
a} :: DescribeJournalS3ExportResponse)

instance
  Prelude.NFData
    DescribeJournalS3ExportResponse