{-# 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.DescribeDBLogFiles
-- 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 a list of DB log files for the DB instance.
--
-- This operation returns paginated results.
module Amazonka.RDS.DescribeDBLogFiles
  ( -- * Creating a Request
    DescribeDBLogFiles (..),
    newDescribeDBLogFiles,

    -- * Request Lenses
    describeDBLogFiles_filenameContains,
    describeDBLogFiles_filters,
    describeDBLogFiles_fileSize,
    describeDBLogFiles_fileLastWritten,
    describeDBLogFiles_marker,
    describeDBLogFiles_maxRecords,
    describeDBLogFiles_dbInstanceIdentifier,

    -- * Destructuring the Response
    DescribeDBLogFilesResponse (..),
    newDescribeDBLogFilesResponse,

    -- * Response Lenses
    describeDBLogFilesResponse_describeDBLogFiles,
    describeDBLogFilesResponse_marker,
    describeDBLogFilesResponse_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:/ 'newDescribeDBLogFiles' smart constructor.
data DescribeDBLogFiles = DescribeDBLogFiles'
  { -- | Filters the available log files for log file names that contain the
    -- specified string.
    DescribeDBLogFiles -> Maybe Text
filenameContains :: Prelude.Maybe Prelude.Text,
    -- | This parameter isn\'t currently supported.
    DescribeDBLogFiles -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | Filters the available log files for files larger than the specified
    -- size.
    DescribeDBLogFiles -> Maybe Integer
fileSize :: Prelude.Maybe Prelude.Integer,
    -- | Filters the available log files for files written since the specified
    -- date, in POSIX timestamp format with milliseconds.
    DescribeDBLogFiles -> Maybe Integer
fileLastWritten :: Prelude.Maybe Prelude.Integer,
    -- | The pagination token provided in the previous request. If this parameter
    -- is specified the response includes only records beyond the marker, up to
    -- MaxRecords.
    DescribeDBLogFiles -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of records to include in the response. If more
    -- records exist than the specified MaxRecords value, a pagination token
    -- called a marker is included in the response so you can retrieve the
    -- remaining results.
    DescribeDBLogFiles -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | 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.
    DescribeDBLogFiles -> Text
dbInstanceIdentifier :: Prelude.Text
  }
  deriving (DescribeDBLogFiles -> DescribeDBLogFiles -> Bool
(DescribeDBLogFiles -> DescribeDBLogFiles -> Bool)
-> (DescribeDBLogFiles -> DescribeDBLogFiles -> Bool)
-> Eq DescribeDBLogFiles
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDBLogFiles -> DescribeDBLogFiles -> Bool
$c/= :: DescribeDBLogFiles -> DescribeDBLogFiles -> Bool
== :: DescribeDBLogFiles -> DescribeDBLogFiles -> Bool
$c== :: DescribeDBLogFiles -> DescribeDBLogFiles -> Bool
Prelude.Eq, ReadPrec [DescribeDBLogFiles]
ReadPrec DescribeDBLogFiles
Int -> ReadS DescribeDBLogFiles
ReadS [DescribeDBLogFiles]
(Int -> ReadS DescribeDBLogFiles)
-> ReadS [DescribeDBLogFiles]
-> ReadPrec DescribeDBLogFiles
-> ReadPrec [DescribeDBLogFiles]
-> Read DescribeDBLogFiles
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDBLogFiles]
$creadListPrec :: ReadPrec [DescribeDBLogFiles]
readPrec :: ReadPrec DescribeDBLogFiles
$creadPrec :: ReadPrec DescribeDBLogFiles
readList :: ReadS [DescribeDBLogFiles]
$creadList :: ReadS [DescribeDBLogFiles]
readsPrec :: Int -> ReadS DescribeDBLogFiles
$creadsPrec :: Int -> ReadS DescribeDBLogFiles
Prelude.Read, Int -> DescribeDBLogFiles -> ShowS
[DescribeDBLogFiles] -> ShowS
DescribeDBLogFiles -> String
(Int -> DescribeDBLogFiles -> ShowS)
-> (DescribeDBLogFiles -> String)
-> ([DescribeDBLogFiles] -> ShowS)
-> Show DescribeDBLogFiles
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDBLogFiles] -> ShowS
$cshowList :: [DescribeDBLogFiles] -> ShowS
show :: DescribeDBLogFiles -> String
$cshow :: DescribeDBLogFiles -> String
showsPrec :: Int -> DescribeDBLogFiles -> ShowS
$cshowsPrec :: Int -> DescribeDBLogFiles -> ShowS
Prelude.Show, (forall x. DescribeDBLogFiles -> Rep DescribeDBLogFiles x)
-> (forall x. Rep DescribeDBLogFiles x -> DescribeDBLogFiles)
-> Generic DescribeDBLogFiles
forall x. Rep DescribeDBLogFiles x -> DescribeDBLogFiles
forall x. DescribeDBLogFiles -> Rep DescribeDBLogFiles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDBLogFiles x -> DescribeDBLogFiles
$cfrom :: forall x. DescribeDBLogFiles -> Rep DescribeDBLogFiles x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDBLogFiles' 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:
--
-- 'filenameContains', 'describeDBLogFiles_filenameContains' - Filters the available log files for log file names that contain the
-- specified string.
--
-- 'filters', 'describeDBLogFiles_filters' - This parameter isn\'t currently supported.
--
-- 'fileSize', 'describeDBLogFiles_fileSize' - Filters the available log files for files larger than the specified
-- size.
--
-- 'fileLastWritten', 'describeDBLogFiles_fileLastWritten' - Filters the available log files for files written since the specified
-- date, in POSIX timestamp format with milliseconds.
--
-- 'marker', 'describeDBLogFiles_marker' - The pagination token provided in the previous request. If this parameter
-- is specified the response includes only records beyond the marker, up to
-- MaxRecords.
--
-- 'maxRecords', 'describeDBLogFiles_maxRecords' - The maximum number of records to include in the response. If more
-- records exist than the specified MaxRecords value, a pagination token
-- called a marker is included in the response so you can retrieve the
-- remaining results.
--
-- 'dbInstanceIdentifier', 'describeDBLogFiles_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.
newDescribeDBLogFiles ::
  -- | 'dbInstanceIdentifier'
  Prelude.Text ->
  DescribeDBLogFiles
newDescribeDBLogFiles :: Text -> DescribeDBLogFiles
newDescribeDBLogFiles Text
pDBInstanceIdentifier_ =
  DescribeDBLogFiles' :: Maybe Text
-> Maybe [Filter]
-> Maybe Integer
-> Maybe Integer
-> Maybe Text
-> Maybe Int
-> Text
-> DescribeDBLogFiles
DescribeDBLogFiles'
    { $sel:filenameContains:DescribeDBLogFiles' :: Maybe Text
filenameContains =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:DescribeDBLogFiles' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:fileSize:DescribeDBLogFiles' :: Maybe Integer
fileSize = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:fileLastWritten:DescribeDBLogFiles' :: Maybe Integer
fileLastWritten = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeDBLogFiles' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeDBLogFiles' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:dbInstanceIdentifier:DescribeDBLogFiles' :: Text
dbInstanceIdentifier = Text
pDBInstanceIdentifier_
    }

-- | Filters the available log files for log file names that contain the
-- specified string.
describeDBLogFiles_filenameContains :: Lens.Lens' DescribeDBLogFiles (Prelude.Maybe Prelude.Text)
describeDBLogFiles_filenameContains :: (Maybe Text -> f (Maybe Text))
-> DescribeDBLogFiles -> f DescribeDBLogFiles
describeDBLogFiles_filenameContains = (DescribeDBLogFiles -> Maybe Text)
-> (DescribeDBLogFiles -> Maybe Text -> DescribeDBLogFiles)
-> Lens
     DescribeDBLogFiles DescribeDBLogFiles (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBLogFiles' {Maybe Text
filenameContains :: Maybe Text
$sel:filenameContains:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe Text
filenameContains} -> Maybe Text
filenameContains) (\s :: DescribeDBLogFiles
s@DescribeDBLogFiles' {} Maybe Text
a -> DescribeDBLogFiles
s {$sel:filenameContains:DescribeDBLogFiles' :: Maybe Text
filenameContains = Maybe Text
a} :: DescribeDBLogFiles)

-- | This parameter isn\'t currently supported.
describeDBLogFiles_filters :: Lens.Lens' DescribeDBLogFiles (Prelude.Maybe [Filter])
describeDBLogFiles_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeDBLogFiles -> f DescribeDBLogFiles
describeDBLogFiles_filters = (DescribeDBLogFiles -> Maybe [Filter])
-> (DescribeDBLogFiles -> Maybe [Filter] -> DescribeDBLogFiles)
-> Lens
     DescribeDBLogFiles
     DescribeDBLogFiles
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBLogFiles' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeDBLogFiles
s@DescribeDBLogFiles' {} Maybe [Filter]
a -> DescribeDBLogFiles
s {$sel:filters:DescribeDBLogFiles' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeDBLogFiles) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeDBLogFiles -> f DescribeDBLogFiles)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeDBLogFiles
-> f DescribeDBLogFiles
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Filters the available log files for files larger than the specified
-- size.
describeDBLogFiles_fileSize :: Lens.Lens' DescribeDBLogFiles (Prelude.Maybe Prelude.Integer)
describeDBLogFiles_fileSize :: (Maybe Integer -> f (Maybe Integer))
-> DescribeDBLogFiles -> f DescribeDBLogFiles
describeDBLogFiles_fileSize = (DescribeDBLogFiles -> Maybe Integer)
-> (DescribeDBLogFiles -> Maybe Integer -> DescribeDBLogFiles)
-> Lens
     DescribeDBLogFiles
     DescribeDBLogFiles
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBLogFiles' {Maybe Integer
fileSize :: Maybe Integer
$sel:fileSize:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe Integer
fileSize} -> Maybe Integer
fileSize) (\s :: DescribeDBLogFiles
s@DescribeDBLogFiles' {} Maybe Integer
a -> DescribeDBLogFiles
s {$sel:fileSize:DescribeDBLogFiles' :: Maybe Integer
fileSize = Maybe Integer
a} :: DescribeDBLogFiles)

-- | Filters the available log files for files written since the specified
-- date, in POSIX timestamp format with milliseconds.
describeDBLogFiles_fileLastWritten :: Lens.Lens' DescribeDBLogFiles (Prelude.Maybe Prelude.Integer)
describeDBLogFiles_fileLastWritten :: (Maybe Integer -> f (Maybe Integer))
-> DescribeDBLogFiles -> f DescribeDBLogFiles
describeDBLogFiles_fileLastWritten = (DescribeDBLogFiles -> Maybe Integer)
-> (DescribeDBLogFiles -> Maybe Integer -> DescribeDBLogFiles)
-> Lens
     DescribeDBLogFiles
     DescribeDBLogFiles
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBLogFiles' {Maybe Integer
fileLastWritten :: Maybe Integer
$sel:fileLastWritten:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe Integer
fileLastWritten} -> Maybe Integer
fileLastWritten) (\s :: DescribeDBLogFiles
s@DescribeDBLogFiles' {} Maybe Integer
a -> DescribeDBLogFiles
s {$sel:fileLastWritten:DescribeDBLogFiles' :: Maybe Integer
fileLastWritten = Maybe Integer
a} :: DescribeDBLogFiles)

-- | The pagination token provided in the previous request. If this parameter
-- is specified the response includes only records beyond the marker, up to
-- MaxRecords.
describeDBLogFiles_marker :: Lens.Lens' DescribeDBLogFiles (Prelude.Maybe Prelude.Text)
describeDBLogFiles_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeDBLogFiles -> f DescribeDBLogFiles
describeDBLogFiles_marker = (DescribeDBLogFiles -> Maybe Text)
-> (DescribeDBLogFiles -> Maybe Text -> DescribeDBLogFiles)
-> Lens
     DescribeDBLogFiles DescribeDBLogFiles (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBLogFiles' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeDBLogFiles
s@DescribeDBLogFiles' {} Maybe Text
a -> DescribeDBLogFiles
s {$sel:marker:DescribeDBLogFiles' :: Maybe Text
marker = Maybe Text
a} :: DescribeDBLogFiles)

-- | The maximum number of records to include in the response. If more
-- records exist than the specified MaxRecords value, a pagination token
-- called a marker is included in the response so you can retrieve the
-- remaining results.
describeDBLogFiles_maxRecords :: Lens.Lens' DescribeDBLogFiles (Prelude.Maybe Prelude.Int)
describeDBLogFiles_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeDBLogFiles -> f DescribeDBLogFiles
describeDBLogFiles_maxRecords = (DescribeDBLogFiles -> Maybe Int)
-> (DescribeDBLogFiles -> Maybe Int -> DescribeDBLogFiles)
-> Lens
     DescribeDBLogFiles DescribeDBLogFiles (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBLogFiles' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeDBLogFiles
s@DescribeDBLogFiles' {} Maybe Int
a -> DescribeDBLogFiles
s {$sel:maxRecords:DescribeDBLogFiles' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeDBLogFiles)

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

instance Core.AWSPager DescribeDBLogFiles where
  page :: DescribeDBLogFiles
-> AWSResponse DescribeDBLogFiles -> Maybe DescribeDBLogFiles
page DescribeDBLogFiles
rq AWSResponse DescribeDBLogFiles
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeDBLogFiles
DescribeDBLogFilesResponse
rs
            DescribeDBLogFilesResponse
-> Getting (First Text) DescribeDBLogFilesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeDBLogFilesResponse
-> Const (First Text) DescribeDBLogFilesResponse
Lens' DescribeDBLogFilesResponse (Maybe Text)
describeDBLogFilesResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeDBLogFilesResponse
 -> Const (First Text) DescribeDBLogFilesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeDBLogFilesResponse 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 DescribeDBLogFiles
forall a. Maybe a
Prelude.Nothing
    | Maybe [DescribeDBLogFilesDetails] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeDBLogFiles
DescribeDBLogFilesResponse
rs
            DescribeDBLogFilesResponse
-> Getting
     (First [DescribeDBLogFilesDetails])
     DescribeDBLogFilesResponse
     [DescribeDBLogFilesDetails]
-> Maybe [DescribeDBLogFilesDetails]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [DescribeDBLogFilesDetails]
 -> Const
      (First [DescribeDBLogFilesDetails])
      (Maybe [DescribeDBLogFilesDetails]))
-> DescribeDBLogFilesResponse
-> Const
     (First [DescribeDBLogFilesDetails]) DescribeDBLogFilesResponse
Lens'
  DescribeDBLogFilesResponse (Maybe [DescribeDBLogFilesDetails])
describeDBLogFilesResponse_describeDBLogFiles
              ((Maybe [DescribeDBLogFilesDetails]
  -> Const
       (First [DescribeDBLogFilesDetails])
       (Maybe [DescribeDBLogFilesDetails]))
 -> DescribeDBLogFilesResponse
 -> Const
      (First [DescribeDBLogFilesDetails]) DescribeDBLogFilesResponse)
-> (([DescribeDBLogFilesDetails]
     -> Const
          (First [DescribeDBLogFilesDetails]) [DescribeDBLogFilesDetails])
    -> Maybe [DescribeDBLogFilesDetails]
    -> Const
         (First [DescribeDBLogFilesDetails])
         (Maybe [DescribeDBLogFilesDetails]))
-> Getting
     (First [DescribeDBLogFilesDetails])
     DescribeDBLogFilesResponse
     [DescribeDBLogFilesDetails]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DescribeDBLogFilesDetails]
 -> Const
      (First [DescribeDBLogFilesDetails]) [DescribeDBLogFilesDetails])
-> Maybe [DescribeDBLogFilesDetails]
-> Const
     (First [DescribeDBLogFilesDetails])
     (Maybe [DescribeDBLogFilesDetails])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeDBLogFiles
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeDBLogFiles -> Maybe DescribeDBLogFiles
forall a. a -> Maybe a
Prelude.Just (DescribeDBLogFiles -> Maybe DescribeDBLogFiles)
-> DescribeDBLogFiles -> Maybe DescribeDBLogFiles
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeDBLogFiles
rq
          DescribeDBLogFiles
-> (DescribeDBLogFiles -> DescribeDBLogFiles) -> DescribeDBLogFiles
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeDBLogFiles -> Identity DescribeDBLogFiles
Lens
  DescribeDBLogFiles DescribeDBLogFiles (Maybe Text) (Maybe Text)
describeDBLogFiles_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeDBLogFiles -> Identity DescribeDBLogFiles)
-> Maybe Text -> DescribeDBLogFiles -> DescribeDBLogFiles
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeDBLogFiles
DescribeDBLogFilesResponse
rs
          DescribeDBLogFilesResponse
-> Getting (First Text) DescribeDBLogFilesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeDBLogFilesResponse
-> Const (First Text) DescribeDBLogFilesResponse
Lens' DescribeDBLogFilesResponse (Maybe Text)
describeDBLogFilesResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeDBLogFilesResponse
 -> Const (First Text) DescribeDBLogFilesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeDBLogFilesResponse 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 DescribeDBLogFiles where
  type
    AWSResponse DescribeDBLogFiles =
      DescribeDBLogFilesResponse
  request :: DescribeDBLogFiles -> Request DescribeDBLogFiles
request = Service -> DescribeDBLogFiles -> Request DescribeDBLogFiles
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeDBLogFiles
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDBLogFiles)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeDBLogFiles))
-> Logger
-> Service
-> Proxy DescribeDBLogFiles
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDBLogFiles)))
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
"DescribeDBLogFilesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [DescribeDBLogFilesDetails]
-> Maybe Text -> Int -> DescribeDBLogFilesResponse
DescribeDBLogFilesResponse'
            (Maybe [DescribeDBLogFilesDetails]
 -> Maybe Text -> Int -> DescribeDBLogFilesResponse)
-> Either String (Maybe [DescribeDBLogFilesDetails])
-> Either String (Maybe Text -> Int -> DescribeDBLogFilesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DescribeDBLogFiles"
                            Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [DescribeDBLogFilesDetails]))
-> Either String (Maybe [DescribeDBLogFilesDetails])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [DescribeDBLogFilesDetails])
-> [Node] -> Either String (Maybe [DescribeDBLogFilesDetails])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may
                              (Text -> [Node] -> Either String [DescribeDBLogFilesDetails]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"DescribeDBLogFilesDetails")
                        )
            Either String (Maybe Text -> Int -> DescribeDBLogFilesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeDBLogFilesResponse)
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 -> DescribeDBLogFilesResponse)
-> Either String Int -> Either String DescribeDBLogFilesResponse
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 DescribeDBLogFiles

instance Prelude.NFData DescribeDBLogFiles

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

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

instance Core.ToQuery DescribeDBLogFiles where
  toQuery :: DescribeDBLogFiles -> QueryString
toQuery DescribeDBLogFiles' {Maybe Int
Maybe Integer
Maybe [Filter]
Maybe Text
Text
dbInstanceIdentifier :: Text
maxRecords :: Maybe Int
marker :: Maybe Text
fileLastWritten :: Maybe Integer
fileSize :: Maybe Integer
filters :: Maybe [Filter]
filenameContains :: Maybe Text
$sel:dbInstanceIdentifier:DescribeDBLogFiles' :: DescribeDBLogFiles -> Text
$sel:maxRecords:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe Int
$sel:marker:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe Text
$sel:fileLastWritten:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe Integer
$sel:fileSize:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe Integer
$sel:filters:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe [Filter]
$sel:filenameContains:DescribeDBLogFiles' :: DescribeDBLogFiles -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DescribeDBLogFiles" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"FilenameContains" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
filenameContains,
        ByteString
"Filters"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Filter] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Filter" ([Filter] -> QueryString) -> Maybe [Filter] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters),
        ByteString
"FileSize" ByteString -> Maybe Integer -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Integer
fileSize,
        ByteString
"FileLastWritten" ByteString -> Maybe Integer -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Integer
fileLastWritten,
        ByteString
"Marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"MaxRecords" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
maxRecords,
        ByteString
"DBInstanceIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbInstanceIdentifier
      ]

-- | The response from a call to @DescribeDBLogFiles@.
--
-- /See:/ 'newDescribeDBLogFilesResponse' smart constructor.
data DescribeDBLogFilesResponse = DescribeDBLogFilesResponse'
  { -- | The DB log files returned.
    DescribeDBLogFilesResponse -> Maybe [DescribeDBLogFilesDetails]
describeDBLogFiles :: Prelude.Maybe [DescribeDBLogFilesDetails],
    -- | A pagination token that can be used in a later DescribeDBLogFiles
    -- request.
    DescribeDBLogFilesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeDBLogFilesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDBLogFilesResponse -> DescribeDBLogFilesResponse -> Bool
(DescribeDBLogFilesResponse -> DescribeDBLogFilesResponse -> Bool)
-> (DescribeDBLogFilesResponse
    -> DescribeDBLogFilesResponse -> Bool)
-> Eq DescribeDBLogFilesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDBLogFilesResponse -> DescribeDBLogFilesResponse -> Bool
$c/= :: DescribeDBLogFilesResponse -> DescribeDBLogFilesResponse -> Bool
== :: DescribeDBLogFilesResponse -> DescribeDBLogFilesResponse -> Bool
$c== :: DescribeDBLogFilesResponse -> DescribeDBLogFilesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDBLogFilesResponse]
ReadPrec DescribeDBLogFilesResponse
Int -> ReadS DescribeDBLogFilesResponse
ReadS [DescribeDBLogFilesResponse]
(Int -> ReadS DescribeDBLogFilesResponse)
-> ReadS [DescribeDBLogFilesResponse]
-> ReadPrec DescribeDBLogFilesResponse
-> ReadPrec [DescribeDBLogFilesResponse]
-> Read DescribeDBLogFilesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDBLogFilesResponse]
$creadListPrec :: ReadPrec [DescribeDBLogFilesResponse]
readPrec :: ReadPrec DescribeDBLogFilesResponse
$creadPrec :: ReadPrec DescribeDBLogFilesResponse
readList :: ReadS [DescribeDBLogFilesResponse]
$creadList :: ReadS [DescribeDBLogFilesResponse]
readsPrec :: Int -> ReadS DescribeDBLogFilesResponse
$creadsPrec :: Int -> ReadS DescribeDBLogFilesResponse
Prelude.Read, Int -> DescribeDBLogFilesResponse -> ShowS
[DescribeDBLogFilesResponse] -> ShowS
DescribeDBLogFilesResponse -> String
(Int -> DescribeDBLogFilesResponse -> ShowS)
-> (DescribeDBLogFilesResponse -> String)
-> ([DescribeDBLogFilesResponse] -> ShowS)
-> Show DescribeDBLogFilesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDBLogFilesResponse] -> ShowS
$cshowList :: [DescribeDBLogFilesResponse] -> ShowS
show :: DescribeDBLogFilesResponse -> String
$cshow :: DescribeDBLogFilesResponse -> String
showsPrec :: Int -> DescribeDBLogFilesResponse -> ShowS
$cshowsPrec :: Int -> DescribeDBLogFilesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDBLogFilesResponse -> Rep DescribeDBLogFilesResponse x)
-> (forall x.
    Rep DescribeDBLogFilesResponse x -> DescribeDBLogFilesResponse)
-> Generic DescribeDBLogFilesResponse
forall x.
Rep DescribeDBLogFilesResponse x -> DescribeDBLogFilesResponse
forall x.
DescribeDBLogFilesResponse -> Rep DescribeDBLogFilesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDBLogFilesResponse x -> DescribeDBLogFilesResponse
$cfrom :: forall x.
DescribeDBLogFilesResponse -> Rep DescribeDBLogFilesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDBLogFilesResponse' 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:
--
-- 'describeDBLogFiles', 'describeDBLogFilesResponse_describeDBLogFiles' - The DB log files returned.
--
-- 'marker', 'describeDBLogFilesResponse_marker' - A pagination token that can be used in a later DescribeDBLogFiles
-- request.
--
-- 'httpStatus', 'describeDBLogFilesResponse_httpStatus' - The response's http status code.
newDescribeDBLogFilesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDBLogFilesResponse
newDescribeDBLogFilesResponse :: Int -> DescribeDBLogFilesResponse
newDescribeDBLogFilesResponse Int
pHttpStatus_ =
  DescribeDBLogFilesResponse' :: Maybe [DescribeDBLogFilesDetails]
-> Maybe Text -> Int -> DescribeDBLogFilesResponse
DescribeDBLogFilesResponse'
    { $sel:describeDBLogFiles:DescribeDBLogFilesResponse' :: Maybe [DescribeDBLogFilesDetails]
describeDBLogFiles =
        Maybe [DescribeDBLogFilesDetails]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeDBLogFilesResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDBLogFilesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The DB log files returned.
describeDBLogFilesResponse_describeDBLogFiles :: Lens.Lens' DescribeDBLogFilesResponse (Prelude.Maybe [DescribeDBLogFilesDetails])
describeDBLogFilesResponse_describeDBLogFiles :: (Maybe [DescribeDBLogFilesDetails]
 -> f (Maybe [DescribeDBLogFilesDetails]))
-> DescribeDBLogFilesResponse -> f DescribeDBLogFilesResponse
describeDBLogFilesResponse_describeDBLogFiles = (DescribeDBLogFilesResponse -> Maybe [DescribeDBLogFilesDetails])
-> (DescribeDBLogFilesResponse
    -> Maybe [DescribeDBLogFilesDetails] -> DescribeDBLogFilesResponse)
-> Lens'
     DescribeDBLogFilesResponse (Maybe [DescribeDBLogFilesDetails])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDBLogFilesResponse' {Maybe [DescribeDBLogFilesDetails]
describeDBLogFiles :: Maybe [DescribeDBLogFilesDetails]
$sel:describeDBLogFiles:DescribeDBLogFilesResponse' :: DescribeDBLogFilesResponse -> Maybe [DescribeDBLogFilesDetails]
describeDBLogFiles} -> Maybe [DescribeDBLogFilesDetails]
describeDBLogFiles) (\s :: DescribeDBLogFilesResponse
s@DescribeDBLogFilesResponse' {} Maybe [DescribeDBLogFilesDetails]
a -> DescribeDBLogFilesResponse
s {$sel:describeDBLogFiles:DescribeDBLogFilesResponse' :: Maybe [DescribeDBLogFilesDetails]
describeDBLogFiles = Maybe [DescribeDBLogFilesDetails]
a} :: DescribeDBLogFilesResponse) ((Maybe [DescribeDBLogFilesDetails]
  -> f (Maybe [DescribeDBLogFilesDetails]))
 -> DescribeDBLogFilesResponse -> f DescribeDBLogFilesResponse)
-> ((Maybe [DescribeDBLogFilesDetails]
     -> f (Maybe [DescribeDBLogFilesDetails]))
    -> Maybe [DescribeDBLogFilesDetails]
    -> f (Maybe [DescribeDBLogFilesDetails]))
-> (Maybe [DescribeDBLogFilesDetails]
    -> f (Maybe [DescribeDBLogFilesDetails]))
-> DescribeDBLogFilesResponse
-> f DescribeDBLogFilesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DescribeDBLogFilesDetails]
  [DescribeDBLogFilesDetails]
  [DescribeDBLogFilesDetails]
  [DescribeDBLogFilesDetails]
-> Iso
     (Maybe [DescribeDBLogFilesDetails])
     (Maybe [DescribeDBLogFilesDetails])
     (Maybe [DescribeDBLogFilesDetails])
     (Maybe [DescribeDBLogFilesDetails])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [DescribeDBLogFilesDetails]
  [DescribeDBLogFilesDetails]
  [DescribeDBLogFilesDetails]
  [DescribeDBLogFilesDetails]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Prelude.NFData DescribeDBLogFilesResponse