{-# 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.RDS.DownloadDBLogFilePortion
-- 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)
--
-- Downloads all or a portion of the specified log file, up to 1 MB in
-- size.
--
-- This operation returns paginated results.
module Amazonka.RDS.DownloadDBLogFilePortion
  ( -- * Creating a Request
    DownloadDBLogFilePortion (..),
    newDownloadDBLogFilePortion,

    -- * Request Lenses
    downloadDBLogFilePortion_numberOfLines,
    downloadDBLogFilePortion_marker,
    downloadDBLogFilePortion_dbInstanceIdentifier,
    downloadDBLogFilePortion_logFileName,

    -- * Destructuring the Response
    DownloadDBLogFilePortionResponse (..),
    newDownloadDBLogFilePortionResponse,

    -- * Response Lenses
    downloadDBLogFilePortionResponse_logFileData,
    downloadDBLogFilePortionResponse_additionalDataPending,
    downloadDBLogFilePortionResponse_marker,
    downloadDBLogFilePortionResponse_httpStatus,
  )
where

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

-- |
--
-- /See:/ 'newDownloadDBLogFilePortion' smart constructor.
data DownloadDBLogFilePortion = DownloadDBLogFilePortion'
  { -- | The number of lines to download. If the number of lines specified
    -- results in a file over 1 MB in size, the file is truncated at 1 MB in
    -- size.
    --
    -- If the NumberOfLines parameter is specified, then the block of lines
    -- returned can be from the beginning or the end of the log file, depending
    -- on the value of the Marker parameter.
    --
    -- -   If neither Marker or NumberOfLines are specified, the entire log
    --     file is returned up to a maximum of 10000 lines, starting with the
    --     most recent log entries first.
    --
    -- -   If NumberOfLines is specified and Marker isn\'t specified, then the
    --     most recent lines from the end of the log file are returned.
    --
    -- -   If Marker is specified as \"0\", then the specified number of lines
    --     from the beginning of the log file are returned.
    --
    -- -   You can download the log file in blocks of lines by specifying the
    --     size of the block using the NumberOfLines parameter, and by
    --     specifying a value of \"0\" for the Marker parameter in your first
    --     request. Include the Marker value returned in the response as the
    --     Marker value for the next request, continuing until the
    --     AdditionalDataPending response element returns false.
    DownloadDBLogFilePortion -> Maybe Int
numberOfLines :: Prelude.Maybe Prelude.Int,
    -- | The pagination token provided in the previous request or \"0\". If the
    -- Marker parameter is specified the response includes only records beyond
    -- the marker until the end of the file or up to NumberOfLines.
    DownloadDBLogFilePortion -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The customer-assigned name of the DB instance that contains the log
    -- files you want to list.
    --
    -- Constraints:
    --
    -- -   Must match the identifier of an existing DBInstance.
    DownloadDBLogFilePortion -> Text
dbInstanceIdentifier :: Prelude.Text,
    -- | The name of the log file to be downloaded.
    DownloadDBLogFilePortion -> Text
logFileName :: Prelude.Text
  }
  deriving (DownloadDBLogFilePortion -> DownloadDBLogFilePortion -> Bool
(DownloadDBLogFilePortion -> DownloadDBLogFilePortion -> Bool)
-> (DownloadDBLogFilePortion -> DownloadDBLogFilePortion -> Bool)
-> Eq DownloadDBLogFilePortion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DownloadDBLogFilePortion -> DownloadDBLogFilePortion -> Bool
$c/= :: DownloadDBLogFilePortion -> DownloadDBLogFilePortion -> Bool
== :: DownloadDBLogFilePortion -> DownloadDBLogFilePortion -> Bool
$c== :: DownloadDBLogFilePortion -> DownloadDBLogFilePortion -> Bool
Prelude.Eq, ReadPrec [DownloadDBLogFilePortion]
ReadPrec DownloadDBLogFilePortion
Int -> ReadS DownloadDBLogFilePortion
ReadS [DownloadDBLogFilePortion]
(Int -> ReadS DownloadDBLogFilePortion)
-> ReadS [DownloadDBLogFilePortion]
-> ReadPrec DownloadDBLogFilePortion
-> ReadPrec [DownloadDBLogFilePortion]
-> Read DownloadDBLogFilePortion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DownloadDBLogFilePortion]
$creadListPrec :: ReadPrec [DownloadDBLogFilePortion]
readPrec :: ReadPrec DownloadDBLogFilePortion
$creadPrec :: ReadPrec DownloadDBLogFilePortion
readList :: ReadS [DownloadDBLogFilePortion]
$creadList :: ReadS [DownloadDBLogFilePortion]
readsPrec :: Int -> ReadS DownloadDBLogFilePortion
$creadsPrec :: Int -> ReadS DownloadDBLogFilePortion
Prelude.Read, Int -> DownloadDBLogFilePortion -> ShowS
[DownloadDBLogFilePortion] -> ShowS
DownloadDBLogFilePortion -> String
(Int -> DownloadDBLogFilePortion -> ShowS)
-> (DownloadDBLogFilePortion -> String)
-> ([DownloadDBLogFilePortion] -> ShowS)
-> Show DownloadDBLogFilePortion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DownloadDBLogFilePortion] -> ShowS
$cshowList :: [DownloadDBLogFilePortion] -> ShowS
show :: DownloadDBLogFilePortion -> String
$cshow :: DownloadDBLogFilePortion -> String
showsPrec :: Int -> DownloadDBLogFilePortion -> ShowS
$cshowsPrec :: Int -> DownloadDBLogFilePortion -> ShowS
Prelude.Show, (forall x.
 DownloadDBLogFilePortion -> Rep DownloadDBLogFilePortion x)
-> (forall x.
    Rep DownloadDBLogFilePortion x -> DownloadDBLogFilePortion)
-> Generic DownloadDBLogFilePortion
forall x.
Rep DownloadDBLogFilePortion x -> DownloadDBLogFilePortion
forall x.
DownloadDBLogFilePortion -> Rep DownloadDBLogFilePortion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DownloadDBLogFilePortion x -> DownloadDBLogFilePortion
$cfrom :: forall x.
DownloadDBLogFilePortion -> Rep DownloadDBLogFilePortion x
Prelude.Generic)

-- |
-- Create a value of 'DownloadDBLogFilePortion' 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:
--
-- 'numberOfLines', 'downloadDBLogFilePortion_numberOfLines' - The number of lines to download. If the number of lines specified
-- results in a file over 1 MB in size, the file is truncated at 1 MB in
-- size.
--
-- If the NumberOfLines parameter is specified, then the block of lines
-- returned can be from the beginning or the end of the log file, depending
-- on the value of the Marker parameter.
--
-- -   If neither Marker or NumberOfLines are specified, the entire log
--     file is returned up to a maximum of 10000 lines, starting with the
--     most recent log entries first.
--
-- -   If NumberOfLines is specified and Marker isn\'t specified, then the
--     most recent lines from the end of the log file are returned.
--
-- -   If Marker is specified as \"0\", then the specified number of lines
--     from the beginning of the log file are returned.
--
-- -   You can download the log file in blocks of lines by specifying the
--     size of the block using the NumberOfLines parameter, and by
--     specifying a value of \"0\" for the Marker parameter in your first
--     request. Include the Marker value returned in the response as the
--     Marker value for the next request, continuing until the
--     AdditionalDataPending response element returns false.
--
-- 'marker', 'downloadDBLogFilePortion_marker' - The pagination token provided in the previous request or \"0\". If the
-- Marker parameter is specified the response includes only records beyond
-- the marker until the end of the file or up to NumberOfLines.
--
-- 'dbInstanceIdentifier', 'downloadDBLogFilePortion_dbInstanceIdentifier' - The customer-assigned name of the DB instance that contains the log
-- files you want to list.
--
-- Constraints:
--
-- -   Must match the identifier of an existing DBInstance.
--
-- 'logFileName', 'downloadDBLogFilePortion_logFileName' - The name of the log file to be downloaded.
newDownloadDBLogFilePortion ::
  -- | 'dbInstanceIdentifier'
  Prelude.Text ->
  -- | 'logFileName'
  Prelude.Text ->
  DownloadDBLogFilePortion
newDownloadDBLogFilePortion :: Text -> Text -> DownloadDBLogFilePortion
newDownloadDBLogFilePortion
  Text
pDBInstanceIdentifier_
  Text
pLogFileName_ =
    DownloadDBLogFilePortion' :: Maybe Int -> Maybe Text -> Text -> Text -> DownloadDBLogFilePortion
DownloadDBLogFilePortion'
      { $sel:numberOfLines:DownloadDBLogFilePortion' :: Maybe Int
numberOfLines =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:marker:DownloadDBLogFilePortion' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:dbInstanceIdentifier:DownloadDBLogFilePortion' :: Text
dbInstanceIdentifier = Text
pDBInstanceIdentifier_,
        $sel:logFileName:DownloadDBLogFilePortion' :: Text
logFileName = Text
pLogFileName_
      }

-- | The number of lines to download. If the number of lines specified
-- results in a file over 1 MB in size, the file is truncated at 1 MB in
-- size.
--
-- If the NumberOfLines parameter is specified, then the block of lines
-- returned can be from the beginning or the end of the log file, depending
-- on the value of the Marker parameter.
--
-- -   If neither Marker or NumberOfLines are specified, the entire log
--     file is returned up to a maximum of 10000 lines, starting with the
--     most recent log entries first.
--
-- -   If NumberOfLines is specified and Marker isn\'t specified, then the
--     most recent lines from the end of the log file are returned.
--
-- -   If Marker is specified as \"0\", then the specified number of lines
--     from the beginning of the log file are returned.
--
-- -   You can download the log file in blocks of lines by specifying the
--     size of the block using the NumberOfLines parameter, and by
--     specifying a value of \"0\" for the Marker parameter in your first
--     request. Include the Marker value returned in the response as the
--     Marker value for the next request, continuing until the
--     AdditionalDataPending response element returns false.
downloadDBLogFilePortion_numberOfLines :: Lens.Lens' DownloadDBLogFilePortion (Prelude.Maybe Prelude.Int)
downloadDBLogFilePortion_numberOfLines :: (Maybe Int -> f (Maybe Int))
-> DownloadDBLogFilePortion -> f DownloadDBLogFilePortion
downloadDBLogFilePortion_numberOfLines = (DownloadDBLogFilePortion -> Maybe Int)
-> (DownloadDBLogFilePortion
    -> Maybe Int -> DownloadDBLogFilePortion)
-> Lens
     DownloadDBLogFilePortion
     DownloadDBLogFilePortion
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DownloadDBLogFilePortion' {Maybe Int
numberOfLines :: Maybe Int
$sel:numberOfLines:DownloadDBLogFilePortion' :: DownloadDBLogFilePortion -> Maybe Int
numberOfLines} -> Maybe Int
numberOfLines) (\s :: DownloadDBLogFilePortion
s@DownloadDBLogFilePortion' {} Maybe Int
a -> DownloadDBLogFilePortion
s {$sel:numberOfLines:DownloadDBLogFilePortion' :: Maybe Int
numberOfLines = Maybe Int
a} :: DownloadDBLogFilePortion)

-- | The pagination token provided in the previous request or \"0\". If the
-- Marker parameter is specified the response includes only records beyond
-- the marker until the end of the file or up to NumberOfLines.
downloadDBLogFilePortion_marker :: Lens.Lens' DownloadDBLogFilePortion (Prelude.Maybe Prelude.Text)
downloadDBLogFilePortion_marker :: (Maybe Text -> f (Maybe Text))
-> DownloadDBLogFilePortion -> f DownloadDBLogFilePortion
downloadDBLogFilePortion_marker = (DownloadDBLogFilePortion -> Maybe Text)
-> (DownloadDBLogFilePortion
    -> Maybe Text -> DownloadDBLogFilePortion)
-> Lens
     DownloadDBLogFilePortion
     DownloadDBLogFilePortion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DownloadDBLogFilePortion' {Maybe Text
marker :: Maybe Text
$sel:marker:DownloadDBLogFilePortion' :: DownloadDBLogFilePortion -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DownloadDBLogFilePortion
s@DownloadDBLogFilePortion' {} Maybe Text
a -> DownloadDBLogFilePortion
s {$sel:marker:DownloadDBLogFilePortion' :: Maybe Text
marker = Maybe Text
a} :: DownloadDBLogFilePortion)

-- | The customer-assigned name of the DB instance that contains the log
-- files you want to list.
--
-- Constraints:
--
-- -   Must match the identifier of an existing DBInstance.
downloadDBLogFilePortion_dbInstanceIdentifier :: Lens.Lens' DownloadDBLogFilePortion Prelude.Text
downloadDBLogFilePortion_dbInstanceIdentifier :: (Text -> f Text)
-> DownloadDBLogFilePortion -> f DownloadDBLogFilePortion
downloadDBLogFilePortion_dbInstanceIdentifier = (DownloadDBLogFilePortion -> Text)
-> (DownloadDBLogFilePortion -> Text -> DownloadDBLogFilePortion)
-> Lens DownloadDBLogFilePortion DownloadDBLogFilePortion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DownloadDBLogFilePortion' {Text
dbInstanceIdentifier :: Text
$sel:dbInstanceIdentifier:DownloadDBLogFilePortion' :: DownloadDBLogFilePortion -> Text
dbInstanceIdentifier} -> Text
dbInstanceIdentifier) (\s :: DownloadDBLogFilePortion
s@DownloadDBLogFilePortion' {} Text
a -> DownloadDBLogFilePortion
s {$sel:dbInstanceIdentifier:DownloadDBLogFilePortion' :: Text
dbInstanceIdentifier = Text
a} :: DownloadDBLogFilePortion)

-- | The name of the log file to be downloaded.
downloadDBLogFilePortion_logFileName :: Lens.Lens' DownloadDBLogFilePortion Prelude.Text
downloadDBLogFilePortion_logFileName :: (Text -> f Text)
-> DownloadDBLogFilePortion -> f DownloadDBLogFilePortion
downloadDBLogFilePortion_logFileName = (DownloadDBLogFilePortion -> Text)
-> (DownloadDBLogFilePortion -> Text -> DownloadDBLogFilePortion)
-> Lens DownloadDBLogFilePortion DownloadDBLogFilePortion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DownloadDBLogFilePortion' {Text
logFileName :: Text
$sel:logFileName:DownloadDBLogFilePortion' :: DownloadDBLogFilePortion -> Text
logFileName} -> Text
logFileName) (\s :: DownloadDBLogFilePortion
s@DownloadDBLogFilePortion' {} Text
a -> DownloadDBLogFilePortion
s {$sel:logFileName:DownloadDBLogFilePortion' :: Text
logFileName = Text
a} :: DownloadDBLogFilePortion)

instance Core.AWSPager DownloadDBLogFilePortion where
  page :: DownloadDBLogFilePortion
-> AWSResponse DownloadDBLogFilePortion
-> Maybe DownloadDBLogFilePortion
page DownloadDBLogFilePortion
rq AWSResponse DownloadDBLogFilePortion
rs
    | Maybe Bool -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DownloadDBLogFilePortion
DownloadDBLogFilePortionResponse
rs
            DownloadDBLogFilePortionResponse
-> Getting (First Bool) DownloadDBLogFilePortionResponse Bool
-> Maybe Bool
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Bool -> Const (First Bool) (Maybe Bool))
-> DownloadDBLogFilePortionResponse
-> Const (First Bool) DownloadDBLogFilePortionResponse
Lens' DownloadDBLogFilePortionResponse (Maybe Bool)
downloadDBLogFilePortionResponse_additionalDataPending
              ((Maybe Bool -> Const (First Bool) (Maybe Bool))
 -> DownloadDBLogFilePortionResponse
 -> Const (First Bool) DownloadDBLogFilePortionResponse)
-> ((Bool -> Const (First Bool) Bool)
    -> Maybe Bool -> Const (First Bool) (Maybe Bool))
-> Getting (First Bool) DownloadDBLogFilePortionResponse Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Bool -> Const (First Bool) Bool)
-> Maybe Bool -> Const (First Bool) (Maybe Bool)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DownloadDBLogFilePortion
forall a. Maybe a
Prelude.Nothing
    | Maybe Text -> Bool
forall a. Maybe a -> Bool
Prelude.isNothing
        ( AWSResponse DownloadDBLogFilePortion
DownloadDBLogFilePortionResponse
rs
            DownloadDBLogFilePortionResponse
-> Getting (First Text) DownloadDBLogFilePortionResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DownloadDBLogFilePortionResponse
-> Const (First Text) DownloadDBLogFilePortionResponse
Lens' DownloadDBLogFilePortionResponse (Maybe Text)
downloadDBLogFilePortionResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DownloadDBLogFilePortionResponse
 -> Const (First Text) DownloadDBLogFilePortionResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DownloadDBLogFilePortionResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DownloadDBLogFilePortion
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DownloadDBLogFilePortion -> Maybe DownloadDBLogFilePortion
forall a. a -> Maybe a
Prelude.Just (DownloadDBLogFilePortion -> Maybe DownloadDBLogFilePortion)
-> DownloadDBLogFilePortion -> Maybe DownloadDBLogFilePortion
forall a b. (a -> b) -> a -> b
Prelude.$
        DownloadDBLogFilePortion
rq
          DownloadDBLogFilePortion
-> (DownloadDBLogFilePortion -> DownloadDBLogFilePortion)
-> DownloadDBLogFilePortion
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DownloadDBLogFilePortion -> Identity DownloadDBLogFilePortion
Lens
  DownloadDBLogFilePortion
  DownloadDBLogFilePortion
  (Maybe Text)
  (Maybe Text)
downloadDBLogFilePortion_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DownloadDBLogFilePortion -> Identity DownloadDBLogFilePortion)
-> Maybe Text
-> DownloadDBLogFilePortion
-> DownloadDBLogFilePortion
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DownloadDBLogFilePortion
DownloadDBLogFilePortionResponse
rs
          DownloadDBLogFilePortionResponse
-> Getting (First Text) DownloadDBLogFilePortionResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DownloadDBLogFilePortionResponse
-> Const (First Text) DownloadDBLogFilePortionResponse
Lens' DownloadDBLogFilePortionResponse (Maybe Text)
downloadDBLogFilePortionResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DownloadDBLogFilePortionResponse
 -> Const (First Text) DownloadDBLogFilePortionResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DownloadDBLogFilePortionResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DownloadDBLogFilePortion where
  type
    AWSResponse DownloadDBLogFilePortion =
      DownloadDBLogFilePortionResponse
  request :: DownloadDBLogFilePortion -> Request DownloadDBLogFilePortion
request = Service
-> DownloadDBLogFilePortion -> Request DownloadDBLogFilePortion
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DownloadDBLogFilePortion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DownloadDBLogFilePortion)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DownloadDBLogFilePortion))
-> Logger
-> Service
-> Proxy DownloadDBLogFilePortion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DownloadDBLogFilePortion)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DownloadDBLogFilePortionResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe Bool
-> Maybe Text
-> Int
-> DownloadDBLogFilePortionResponse
DownloadDBLogFilePortionResponse'
            (Maybe Text
 -> Maybe Bool
 -> Maybe Text
 -> Int
 -> DownloadDBLogFilePortionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Bool
      -> Maybe Text -> Int -> DownloadDBLogFilePortionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LogFileData")
            Either
  String
  (Maybe Bool
   -> Maybe Text -> Int -> DownloadDBLogFilePortionResponse)
-> Either String (Maybe Bool)
-> Either
     String (Maybe Text -> Int -> DownloadDBLogFilePortionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Bool)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"AdditionalDataPending")
            Either
  String (Maybe Text -> Int -> DownloadDBLogFilePortionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DownloadDBLogFilePortionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Marker")
            Either String (Int -> DownloadDBLogFilePortionResponse)
-> Either String Int
-> Either String DownloadDBLogFilePortionResponse
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 DownloadDBLogFilePortion

instance Prelude.NFData DownloadDBLogFilePortion

instance Core.ToHeaders DownloadDBLogFilePortion where
  toHeaders :: DownloadDBLogFilePortion -> ResponseHeaders
toHeaders = ResponseHeaders -> DownloadDBLogFilePortion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DownloadDBLogFilePortion where
  toPath :: DownloadDBLogFilePortion -> ByteString
toPath = ByteString -> DownloadDBLogFilePortion -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DownloadDBLogFilePortion where
  toQuery :: DownloadDBLogFilePortion -> QueryString
toQuery DownloadDBLogFilePortion' {Maybe Int
Maybe Text
Text
logFileName :: Text
dbInstanceIdentifier :: Text
marker :: Maybe Text
numberOfLines :: Maybe Int
$sel:logFileName:DownloadDBLogFilePortion' :: DownloadDBLogFilePortion -> Text
$sel:dbInstanceIdentifier:DownloadDBLogFilePortion' :: DownloadDBLogFilePortion -> Text
$sel:marker:DownloadDBLogFilePortion' :: DownloadDBLogFilePortion -> Maybe Text
$sel:numberOfLines:DownloadDBLogFilePortion' :: DownloadDBLogFilePortion -> Maybe Int
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DownloadDBLogFilePortion" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"NumberOfLines" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
numberOfLines,
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"DBInstanceIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbInstanceIdentifier,
        ByteString
"LogFileName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
logFileName
      ]

-- | This data type is used as a response element to
-- @DownloadDBLogFilePortion@.
--
-- /See:/ 'newDownloadDBLogFilePortionResponse' smart constructor.
data DownloadDBLogFilePortionResponse = DownloadDBLogFilePortionResponse'
  { -- | Entries from the specified log file.
    DownloadDBLogFilePortionResponse -> Maybe Text
logFileData :: Prelude.Maybe Prelude.Text,
    -- | Boolean value that if true, indicates there is more data to be
    -- downloaded.
    DownloadDBLogFilePortionResponse -> Maybe Bool
additionalDataPending :: Prelude.Maybe Prelude.Bool,
    -- | A pagination token that can be used in a later DownloadDBLogFilePortion
    -- request.
    DownloadDBLogFilePortionResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DownloadDBLogFilePortionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DownloadDBLogFilePortionResponse
-> DownloadDBLogFilePortionResponse -> Bool
(DownloadDBLogFilePortionResponse
 -> DownloadDBLogFilePortionResponse -> Bool)
-> (DownloadDBLogFilePortionResponse
    -> DownloadDBLogFilePortionResponse -> Bool)
-> Eq DownloadDBLogFilePortionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DownloadDBLogFilePortionResponse
-> DownloadDBLogFilePortionResponse -> Bool
$c/= :: DownloadDBLogFilePortionResponse
-> DownloadDBLogFilePortionResponse -> Bool
== :: DownloadDBLogFilePortionResponse
-> DownloadDBLogFilePortionResponse -> Bool
$c== :: DownloadDBLogFilePortionResponse
-> DownloadDBLogFilePortionResponse -> Bool
Prelude.Eq, ReadPrec [DownloadDBLogFilePortionResponse]
ReadPrec DownloadDBLogFilePortionResponse
Int -> ReadS DownloadDBLogFilePortionResponse
ReadS [DownloadDBLogFilePortionResponse]
(Int -> ReadS DownloadDBLogFilePortionResponse)
-> ReadS [DownloadDBLogFilePortionResponse]
-> ReadPrec DownloadDBLogFilePortionResponse
-> ReadPrec [DownloadDBLogFilePortionResponse]
-> Read DownloadDBLogFilePortionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DownloadDBLogFilePortionResponse]
$creadListPrec :: ReadPrec [DownloadDBLogFilePortionResponse]
readPrec :: ReadPrec DownloadDBLogFilePortionResponse
$creadPrec :: ReadPrec DownloadDBLogFilePortionResponse
readList :: ReadS [DownloadDBLogFilePortionResponse]
$creadList :: ReadS [DownloadDBLogFilePortionResponse]
readsPrec :: Int -> ReadS DownloadDBLogFilePortionResponse
$creadsPrec :: Int -> ReadS DownloadDBLogFilePortionResponse
Prelude.Read, Int -> DownloadDBLogFilePortionResponse -> ShowS
[DownloadDBLogFilePortionResponse] -> ShowS
DownloadDBLogFilePortionResponse -> String
(Int -> DownloadDBLogFilePortionResponse -> ShowS)
-> (DownloadDBLogFilePortionResponse -> String)
-> ([DownloadDBLogFilePortionResponse] -> ShowS)
-> Show DownloadDBLogFilePortionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DownloadDBLogFilePortionResponse] -> ShowS
$cshowList :: [DownloadDBLogFilePortionResponse] -> ShowS
show :: DownloadDBLogFilePortionResponse -> String
$cshow :: DownloadDBLogFilePortionResponse -> String
showsPrec :: Int -> DownloadDBLogFilePortionResponse -> ShowS
$cshowsPrec :: Int -> DownloadDBLogFilePortionResponse -> ShowS
Prelude.Show, (forall x.
 DownloadDBLogFilePortionResponse
 -> Rep DownloadDBLogFilePortionResponse x)
-> (forall x.
    Rep DownloadDBLogFilePortionResponse x
    -> DownloadDBLogFilePortionResponse)
-> Generic DownloadDBLogFilePortionResponse
forall x.
Rep DownloadDBLogFilePortionResponse x
-> DownloadDBLogFilePortionResponse
forall x.
DownloadDBLogFilePortionResponse
-> Rep DownloadDBLogFilePortionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DownloadDBLogFilePortionResponse x
-> DownloadDBLogFilePortionResponse
$cfrom :: forall x.
DownloadDBLogFilePortionResponse
-> Rep DownloadDBLogFilePortionResponse x
Prelude.Generic)

-- |
-- Create a value of 'DownloadDBLogFilePortionResponse' 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:
--
-- 'logFileData', 'downloadDBLogFilePortionResponse_logFileData' - Entries from the specified log file.
--
-- 'additionalDataPending', 'downloadDBLogFilePortionResponse_additionalDataPending' - Boolean value that if true, indicates there is more data to be
-- downloaded.
--
-- 'marker', 'downloadDBLogFilePortionResponse_marker' - A pagination token that can be used in a later DownloadDBLogFilePortion
-- request.
--
-- 'httpStatus', 'downloadDBLogFilePortionResponse_httpStatus' - The response's http status code.
newDownloadDBLogFilePortionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DownloadDBLogFilePortionResponse
newDownloadDBLogFilePortionResponse :: Int -> DownloadDBLogFilePortionResponse
newDownloadDBLogFilePortionResponse Int
pHttpStatus_ =
  DownloadDBLogFilePortionResponse' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Int
-> DownloadDBLogFilePortionResponse
DownloadDBLogFilePortionResponse'
    { $sel:logFileData:DownloadDBLogFilePortionResponse' :: Maybe Text
logFileData =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:additionalDataPending:DownloadDBLogFilePortionResponse' :: Maybe Bool
additionalDataPending = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DownloadDBLogFilePortionResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DownloadDBLogFilePortionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Entries from the specified log file.
downloadDBLogFilePortionResponse_logFileData :: Lens.Lens' DownloadDBLogFilePortionResponse (Prelude.Maybe Prelude.Text)
downloadDBLogFilePortionResponse_logFileData :: (Maybe Text -> f (Maybe Text))
-> DownloadDBLogFilePortionResponse
-> f DownloadDBLogFilePortionResponse
downloadDBLogFilePortionResponse_logFileData = (DownloadDBLogFilePortionResponse -> Maybe Text)
-> (DownloadDBLogFilePortionResponse
    -> Maybe Text -> DownloadDBLogFilePortionResponse)
-> Lens' DownloadDBLogFilePortionResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DownloadDBLogFilePortionResponse' {Maybe Text
logFileData :: Maybe Text
$sel:logFileData:DownloadDBLogFilePortionResponse' :: DownloadDBLogFilePortionResponse -> Maybe Text
logFileData} -> Maybe Text
logFileData) (\s :: DownloadDBLogFilePortionResponse
s@DownloadDBLogFilePortionResponse' {} Maybe Text
a -> DownloadDBLogFilePortionResponse
s {$sel:logFileData:DownloadDBLogFilePortionResponse' :: Maybe Text
logFileData = Maybe Text
a} :: DownloadDBLogFilePortionResponse)

-- | Boolean value that if true, indicates there is more data to be
-- downloaded.
downloadDBLogFilePortionResponse_additionalDataPending :: Lens.Lens' DownloadDBLogFilePortionResponse (Prelude.Maybe Prelude.Bool)
downloadDBLogFilePortionResponse_additionalDataPending :: (Maybe Bool -> f (Maybe Bool))
-> DownloadDBLogFilePortionResponse
-> f DownloadDBLogFilePortionResponse
downloadDBLogFilePortionResponse_additionalDataPending = (DownloadDBLogFilePortionResponse -> Maybe Bool)
-> (DownloadDBLogFilePortionResponse
    -> Maybe Bool -> DownloadDBLogFilePortionResponse)
-> Lens' DownloadDBLogFilePortionResponse (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DownloadDBLogFilePortionResponse' {Maybe Bool
additionalDataPending :: Maybe Bool
$sel:additionalDataPending:DownloadDBLogFilePortionResponse' :: DownloadDBLogFilePortionResponse -> Maybe Bool
additionalDataPending} -> Maybe Bool
additionalDataPending) (\s :: DownloadDBLogFilePortionResponse
s@DownloadDBLogFilePortionResponse' {} Maybe Bool
a -> DownloadDBLogFilePortionResponse
s {$sel:additionalDataPending:DownloadDBLogFilePortionResponse' :: Maybe Bool
additionalDataPending = Maybe Bool
a} :: DownloadDBLogFilePortionResponse)

-- | A pagination token that can be used in a later DownloadDBLogFilePortion
-- request.
downloadDBLogFilePortionResponse_marker :: Lens.Lens' DownloadDBLogFilePortionResponse (Prelude.Maybe Prelude.Text)
downloadDBLogFilePortionResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DownloadDBLogFilePortionResponse
-> f DownloadDBLogFilePortionResponse
downloadDBLogFilePortionResponse_marker = (DownloadDBLogFilePortionResponse -> Maybe Text)
-> (DownloadDBLogFilePortionResponse
    -> Maybe Text -> DownloadDBLogFilePortionResponse)
-> Lens' DownloadDBLogFilePortionResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DownloadDBLogFilePortionResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DownloadDBLogFilePortionResponse' :: DownloadDBLogFilePortionResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DownloadDBLogFilePortionResponse
s@DownloadDBLogFilePortionResponse' {} Maybe Text
a -> DownloadDBLogFilePortionResponse
s {$sel:marker:DownloadDBLogFilePortionResponse' :: Maybe Text
marker = Maybe Text
a} :: DownloadDBLogFilePortionResponse)

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

instance
  Prelude.NFData
    DownloadDBLogFilePortionResponse