{-# 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.Lightsail.GetRelationalDatabaseLogEvents
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of log events for a database in Amazon Lightsail.
module Amazonka.Lightsail.GetRelationalDatabaseLogEvents
  ( -- * Creating a Request
    GetRelationalDatabaseLogEvents (..),
    newGetRelationalDatabaseLogEvents,

    -- * Request Lenses
    getRelationalDatabaseLogEvents_endTime,
    getRelationalDatabaseLogEvents_pageToken,
    getRelationalDatabaseLogEvents_startFromHead,
    getRelationalDatabaseLogEvents_startTime,
    getRelationalDatabaseLogEvents_relationalDatabaseName,
    getRelationalDatabaseLogEvents_logStreamName,

    -- * Destructuring the Response
    GetRelationalDatabaseLogEventsResponse (..),
    newGetRelationalDatabaseLogEventsResponse,

    -- * Response Lenses
    getRelationalDatabaseLogEventsResponse_nextBackwardToken,
    getRelationalDatabaseLogEventsResponse_nextForwardToken,
    getRelationalDatabaseLogEventsResponse_resourceLogEvents,
    getRelationalDatabaseLogEventsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetRelationalDatabaseLogEvents' smart constructor.
data GetRelationalDatabaseLogEvents = GetRelationalDatabaseLogEvents'
  { -- | The end of the time interval from which to get log events.
    --
    -- Constraints:
    --
    -- -   Specified in Coordinated Universal Time (UTC).
    --
    -- -   Specified in the Unix time format.
    --
    --     For example, if you wish to use an end time of October 1, 2018, at 8
    --     PM UTC, then you input @1538424000@ as the end time.
    GetRelationalDatabaseLogEvents -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | The token to advance to the next or previous page of results from your
    -- request.
    --
    -- To get a page token, perform an initial @GetRelationalDatabaseLogEvents@
    -- request. If your results are paginated, the response will return a next
    -- forward token and\/or next backward token that you can specify as the
    -- page token in a subsequent request.
    GetRelationalDatabaseLogEvents -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | Parameter to specify if the log should start from head or tail. If
    -- @true@ is specified, the log event starts from the head of the log. If
    -- @false@ is specified, the log event starts from the tail of the log.
    --
    -- For PostgreSQL, the default value of @false@ is the only option
    -- available.
    GetRelationalDatabaseLogEvents -> Maybe Bool
startFromHead :: Prelude.Maybe Prelude.Bool,
    -- | The start of the time interval from which to get log events.
    --
    -- Constraints:
    --
    -- -   Specified in Coordinated Universal Time (UTC).
    --
    -- -   Specified in the Unix time format.
    --
    --     For example, if you wish to use a start time of October 1, 2018, at
    --     8 PM UTC, then you input @1538424000@ as the start time.
    GetRelationalDatabaseLogEvents -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX,
    -- | The name of your database for which to get log events.
    GetRelationalDatabaseLogEvents -> Text
relationalDatabaseName :: Prelude.Text,
    -- | The name of the log stream.
    --
    -- Use the @get relational database log streams@ operation to get a list of
    -- available log streams.
    GetRelationalDatabaseLogEvents -> Text
logStreamName :: Prelude.Text
  }
  deriving (GetRelationalDatabaseLogEvents
-> GetRelationalDatabaseLogEvents -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRelationalDatabaseLogEvents
-> GetRelationalDatabaseLogEvents -> Bool
$c/= :: GetRelationalDatabaseLogEvents
-> GetRelationalDatabaseLogEvents -> Bool
== :: GetRelationalDatabaseLogEvents
-> GetRelationalDatabaseLogEvents -> Bool
$c== :: GetRelationalDatabaseLogEvents
-> GetRelationalDatabaseLogEvents -> Bool
Prelude.Eq, ReadPrec [GetRelationalDatabaseLogEvents]
ReadPrec GetRelationalDatabaseLogEvents
Int -> ReadS GetRelationalDatabaseLogEvents
ReadS [GetRelationalDatabaseLogEvents]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRelationalDatabaseLogEvents]
$creadListPrec :: ReadPrec [GetRelationalDatabaseLogEvents]
readPrec :: ReadPrec GetRelationalDatabaseLogEvents
$creadPrec :: ReadPrec GetRelationalDatabaseLogEvents
readList :: ReadS [GetRelationalDatabaseLogEvents]
$creadList :: ReadS [GetRelationalDatabaseLogEvents]
readsPrec :: Int -> ReadS GetRelationalDatabaseLogEvents
$creadsPrec :: Int -> ReadS GetRelationalDatabaseLogEvents
Prelude.Read, Int -> GetRelationalDatabaseLogEvents -> ShowS
[GetRelationalDatabaseLogEvents] -> ShowS
GetRelationalDatabaseLogEvents -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRelationalDatabaseLogEvents] -> ShowS
$cshowList :: [GetRelationalDatabaseLogEvents] -> ShowS
show :: GetRelationalDatabaseLogEvents -> String
$cshow :: GetRelationalDatabaseLogEvents -> String
showsPrec :: Int -> GetRelationalDatabaseLogEvents -> ShowS
$cshowsPrec :: Int -> GetRelationalDatabaseLogEvents -> ShowS
Prelude.Show, forall x.
Rep GetRelationalDatabaseLogEvents x
-> GetRelationalDatabaseLogEvents
forall x.
GetRelationalDatabaseLogEvents
-> Rep GetRelationalDatabaseLogEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRelationalDatabaseLogEvents x
-> GetRelationalDatabaseLogEvents
$cfrom :: forall x.
GetRelationalDatabaseLogEvents
-> Rep GetRelationalDatabaseLogEvents x
Prelude.Generic)

-- |
-- Create a value of 'GetRelationalDatabaseLogEvents' 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:
--
-- 'endTime', 'getRelationalDatabaseLogEvents_endTime' - The end of the time interval from which to get log events.
--
-- Constraints:
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Specified in the Unix time format.
--
--     For example, if you wish to use an end time of October 1, 2018, at 8
--     PM UTC, then you input @1538424000@ as the end time.
--
-- 'pageToken', 'getRelationalDatabaseLogEvents_pageToken' - The token to advance to the next or previous page of results from your
-- request.
--
-- To get a page token, perform an initial @GetRelationalDatabaseLogEvents@
-- request. If your results are paginated, the response will return a next
-- forward token and\/or next backward token that you can specify as the
-- page token in a subsequent request.
--
-- 'startFromHead', 'getRelationalDatabaseLogEvents_startFromHead' - Parameter to specify if the log should start from head or tail. If
-- @true@ is specified, the log event starts from the head of the log. If
-- @false@ is specified, the log event starts from the tail of the log.
--
-- For PostgreSQL, the default value of @false@ is the only option
-- available.
--
-- 'startTime', 'getRelationalDatabaseLogEvents_startTime' - The start of the time interval from which to get log events.
--
-- Constraints:
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Specified in the Unix time format.
--
--     For example, if you wish to use a start time of October 1, 2018, at
--     8 PM UTC, then you input @1538424000@ as the start time.
--
-- 'relationalDatabaseName', 'getRelationalDatabaseLogEvents_relationalDatabaseName' - The name of your database for which to get log events.
--
-- 'logStreamName', 'getRelationalDatabaseLogEvents_logStreamName' - The name of the log stream.
--
-- Use the @get relational database log streams@ operation to get a list of
-- available log streams.
newGetRelationalDatabaseLogEvents ::
  -- | 'relationalDatabaseName'
  Prelude.Text ->
  -- | 'logStreamName'
  Prelude.Text ->
  GetRelationalDatabaseLogEvents
newGetRelationalDatabaseLogEvents :: Text -> Text -> GetRelationalDatabaseLogEvents
newGetRelationalDatabaseLogEvents
  Text
pRelationalDatabaseName_
  Text
pLogStreamName_ =
    GetRelationalDatabaseLogEvents'
      { $sel:endTime:GetRelationalDatabaseLogEvents' :: Maybe POSIX
endTime =
          forall a. Maybe a
Prelude.Nothing,
        $sel:pageToken:GetRelationalDatabaseLogEvents' :: Maybe Text
pageToken = forall a. Maybe a
Prelude.Nothing,
        $sel:startFromHead:GetRelationalDatabaseLogEvents' :: Maybe Bool
startFromHead = forall a. Maybe a
Prelude.Nothing,
        $sel:startTime:GetRelationalDatabaseLogEvents' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing,
        $sel:relationalDatabaseName:GetRelationalDatabaseLogEvents' :: Text
relationalDatabaseName =
          Text
pRelationalDatabaseName_,
        $sel:logStreamName:GetRelationalDatabaseLogEvents' :: Text
logStreamName = Text
pLogStreamName_
      }

-- | The end of the time interval from which to get log events.
--
-- Constraints:
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Specified in the Unix time format.
--
--     For example, if you wish to use an end time of October 1, 2018, at 8
--     PM UTC, then you input @1538424000@ as the end time.
getRelationalDatabaseLogEvents_endTime :: Lens.Lens' GetRelationalDatabaseLogEvents (Prelude.Maybe Prelude.UTCTime)
getRelationalDatabaseLogEvents_endTime :: Lens' GetRelationalDatabaseLogEvents (Maybe UTCTime)
getRelationalDatabaseLogEvents_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseLogEvents' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: GetRelationalDatabaseLogEvents
s@GetRelationalDatabaseLogEvents' {} Maybe POSIX
a -> GetRelationalDatabaseLogEvents
s {$sel:endTime:GetRelationalDatabaseLogEvents' :: Maybe POSIX
endTime = Maybe POSIX
a} :: GetRelationalDatabaseLogEvents) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The token to advance to the next or previous page of results from your
-- request.
--
-- To get a page token, perform an initial @GetRelationalDatabaseLogEvents@
-- request. If your results are paginated, the response will return a next
-- forward token and\/or next backward token that you can specify as the
-- page token in a subsequent request.
getRelationalDatabaseLogEvents_pageToken :: Lens.Lens' GetRelationalDatabaseLogEvents (Prelude.Maybe Prelude.Text)
getRelationalDatabaseLogEvents_pageToken :: Lens' GetRelationalDatabaseLogEvents (Maybe Text)
getRelationalDatabaseLogEvents_pageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseLogEvents' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: GetRelationalDatabaseLogEvents
s@GetRelationalDatabaseLogEvents' {} Maybe Text
a -> GetRelationalDatabaseLogEvents
s {$sel:pageToken:GetRelationalDatabaseLogEvents' :: Maybe Text
pageToken = Maybe Text
a} :: GetRelationalDatabaseLogEvents)

-- | Parameter to specify if the log should start from head or tail. If
-- @true@ is specified, the log event starts from the head of the log. If
-- @false@ is specified, the log event starts from the tail of the log.
--
-- For PostgreSQL, the default value of @false@ is the only option
-- available.
getRelationalDatabaseLogEvents_startFromHead :: Lens.Lens' GetRelationalDatabaseLogEvents (Prelude.Maybe Prelude.Bool)
getRelationalDatabaseLogEvents_startFromHead :: Lens' GetRelationalDatabaseLogEvents (Maybe Bool)
getRelationalDatabaseLogEvents_startFromHead = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseLogEvents' {Maybe Bool
startFromHead :: Maybe Bool
$sel:startFromHead:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe Bool
startFromHead} -> Maybe Bool
startFromHead) (\s :: GetRelationalDatabaseLogEvents
s@GetRelationalDatabaseLogEvents' {} Maybe Bool
a -> GetRelationalDatabaseLogEvents
s {$sel:startFromHead:GetRelationalDatabaseLogEvents' :: Maybe Bool
startFromHead = Maybe Bool
a} :: GetRelationalDatabaseLogEvents)

-- | The start of the time interval from which to get log events.
--
-- Constraints:
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Specified in the Unix time format.
--
--     For example, if you wish to use a start time of October 1, 2018, at
--     8 PM UTC, then you input @1538424000@ as the start time.
getRelationalDatabaseLogEvents_startTime :: Lens.Lens' GetRelationalDatabaseLogEvents (Prelude.Maybe Prelude.UTCTime)
getRelationalDatabaseLogEvents_startTime :: Lens' GetRelationalDatabaseLogEvents (Maybe UTCTime)
getRelationalDatabaseLogEvents_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseLogEvents' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: GetRelationalDatabaseLogEvents
s@GetRelationalDatabaseLogEvents' {} Maybe POSIX
a -> GetRelationalDatabaseLogEvents
s {$sel:startTime:GetRelationalDatabaseLogEvents' :: Maybe POSIX
startTime = Maybe POSIX
a} :: GetRelationalDatabaseLogEvents) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of your database for which to get log events.
getRelationalDatabaseLogEvents_relationalDatabaseName :: Lens.Lens' GetRelationalDatabaseLogEvents Prelude.Text
getRelationalDatabaseLogEvents_relationalDatabaseName :: Lens' GetRelationalDatabaseLogEvents Text
getRelationalDatabaseLogEvents_relationalDatabaseName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseLogEvents' {Text
relationalDatabaseName :: Text
$sel:relationalDatabaseName:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Text
relationalDatabaseName} -> Text
relationalDatabaseName) (\s :: GetRelationalDatabaseLogEvents
s@GetRelationalDatabaseLogEvents' {} Text
a -> GetRelationalDatabaseLogEvents
s {$sel:relationalDatabaseName:GetRelationalDatabaseLogEvents' :: Text
relationalDatabaseName = Text
a} :: GetRelationalDatabaseLogEvents)

-- | The name of the log stream.
--
-- Use the @get relational database log streams@ operation to get a list of
-- available log streams.
getRelationalDatabaseLogEvents_logStreamName :: Lens.Lens' GetRelationalDatabaseLogEvents Prelude.Text
getRelationalDatabaseLogEvents_logStreamName :: Lens' GetRelationalDatabaseLogEvents Text
getRelationalDatabaseLogEvents_logStreamName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseLogEvents' {Text
logStreamName :: Text
$sel:logStreamName:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Text
logStreamName} -> Text
logStreamName) (\s :: GetRelationalDatabaseLogEvents
s@GetRelationalDatabaseLogEvents' {} Text
a -> GetRelationalDatabaseLogEvents
s {$sel:logStreamName:GetRelationalDatabaseLogEvents' :: Text
logStreamName = Text
a} :: GetRelationalDatabaseLogEvents)

instance
  Core.AWSRequest
    GetRelationalDatabaseLogEvents
  where
  type
    AWSResponse GetRelationalDatabaseLogEvents =
      GetRelationalDatabaseLogEventsResponse
  request :: (Service -> Service)
-> GetRelationalDatabaseLogEvents
-> Request GetRelationalDatabaseLogEvents
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetRelationalDatabaseLogEvents
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetRelationalDatabaseLogEvents)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe [LogEvent]
-> Int
-> GetRelationalDatabaseLogEventsResponse
GetRelationalDatabaseLogEventsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextBackwardToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextForwardToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"resourceLogEvents"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    GetRelationalDatabaseLogEvents
  where
  hashWithSalt :: Int -> GetRelationalDatabaseLogEvents -> Int
hashWithSalt
    Int
_salt
    GetRelationalDatabaseLogEvents' {Maybe Bool
Maybe Text
Maybe POSIX
Text
logStreamName :: Text
relationalDatabaseName :: Text
startTime :: Maybe POSIX
startFromHead :: Maybe Bool
pageToken :: Maybe Text
endTime :: Maybe POSIX
$sel:logStreamName:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Text
$sel:relationalDatabaseName:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Text
$sel:startTime:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe POSIX
$sel:startFromHead:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe Bool
$sel:pageToken:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe Text
$sel:endTime:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe POSIX
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pageToken
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
startFromHead
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
relationalDatabaseName
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
logStreamName

instance
  Prelude.NFData
    GetRelationalDatabaseLogEvents
  where
  rnf :: GetRelationalDatabaseLogEvents -> ()
rnf GetRelationalDatabaseLogEvents' {Maybe Bool
Maybe Text
Maybe POSIX
Text
logStreamName :: Text
relationalDatabaseName :: Text
startTime :: Maybe POSIX
startFromHead :: Maybe Bool
pageToken :: Maybe Text
endTime :: Maybe POSIX
$sel:logStreamName:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Text
$sel:relationalDatabaseName:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Text
$sel:startTime:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe POSIX
$sel:startFromHead:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe Bool
$sel:pageToken:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe Text
$sel:endTime:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pageToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
startFromHead
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
relationalDatabaseName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
logStreamName

instance
  Data.ToHeaders
    GetRelationalDatabaseLogEvents
  where
  toHeaders :: GetRelationalDatabaseLogEvents -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Lightsail_20161128.GetRelationalDatabaseLogEvents" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetRelationalDatabaseLogEvents where
  toJSON :: GetRelationalDatabaseLogEvents -> Value
toJSON GetRelationalDatabaseLogEvents' {Maybe Bool
Maybe Text
Maybe POSIX
Text
logStreamName :: Text
relationalDatabaseName :: Text
startTime :: Maybe POSIX
startFromHead :: Maybe Bool
pageToken :: Maybe Text
endTime :: Maybe POSIX
$sel:logStreamName:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Text
$sel:relationalDatabaseName:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Text
$sel:startTime:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe POSIX
$sel:startFromHead:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe Bool
$sel:pageToken:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe Text
$sel:endTime:GetRelationalDatabaseLogEvents' :: GetRelationalDatabaseLogEvents -> Maybe POSIX
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"endTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
endTime,
            (Key
"pageToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
pageToken,
            (Key
"startFromHead" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
startFromHead,
            (Key
"startTime" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe POSIX
startTime,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"relationalDatabaseName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
relationalDatabaseName
              ),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"logStreamName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
logStreamName)
          ]
      )

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

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

-- | /See:/ 'newGetRelationalDatabaseLogEventsResponse' smart constructor.
data GetRelationalDatabaseLogEventsResponse = GetRelationalDatabaseLogEventsResponse'
  { -- | A token used for advancing to the previous page of results from your get
    -- relational database log events request.
    GetRelationalDatabaseLogEventsResponse -> Maybe Text
nextBackwardToken :: Prelude.Maybe Prelude.Text,
    -- | A token used for advancing to the next page of results from your get
    -- relational database log events request.
    GetRelationalDatabaseLogEventsResponse -> Maybe Text
nextForwardToken :: Prelude.Maybe Prelude.Text,
    -- | An object describing the result of your get relational database log
    -- events request.
    GetRelationalDatabaseLogEventsResponse -> Maybe [LogEvent]
resourceLogEvents :: Prelude.Maybe [LogEvent],
    -- | The response's http status code.
    GetRelationalDatabaseLogEventsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetRelationalDatabaseLogEventsResponse
-> GetRelationalDatabaseLogEventsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRelationalDatabaseLogEventsResponse
-> GetRelationalDatabaseLogEventsResponse -> Bool
$c/= :: GetRelationalDatabaseLogEventsResponse
-> GetRelationalDatabaseLogEventsResponse -> Bool
== :: GetRelationalDatabaseLogEventsResponse
-> GetRelationalDatabaseLogEventsResponse -> Bool
$c== :: GetRelationalDatabaseLogEventsResponse
-> GetRelationalDatabaseLogEventsResponse -> Bool
Prelude.Eq, ReadPrec [GetRelationalDatabaseLogEventsResponse]
ReadPrec GetRelationalDatabaseLogEventsResponse
Int -> ReadS GetRelationalDatabaseLogEventsResponse
ReadS [GetRelationalDatabaseLogEventsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRelationalDatabaseLogEventsResponse]
$creadListPrec :: ReadPrec [GetRelationalDatabaseLogEventsResponse]
readPrec :: ReadPrec GetRelationalDatabaseLogEventsResponse
$creadPrec :: ReadPrec GetRelationalDatabaseLogEventsResponse
readList :: ReadS [GetRelationalDatabaseLogEventsResponse]
$creadList :: ReadS [GetRelationalDatabaseLogEventsResponse]
readsPrec :: Int -> ReadS GetRelationalDatabaseLogEventsResponse
$creadsPrec :: Int -> ReadS GetRelationalDatabaseLogEventsResponse
Prelude.Read, Int -> GetRelationalDatabaseLogEventsResponse -> ShowS
[GetRelationalDatabaseLogEventsResponse] -> ShowS
GetRelationalDatabaseLogEventsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRelationalDatabaseLogEventsResponse] -> ShowS
$cshowList :: [GetRelationalDatabaseLogEventsResponse] -> ShowS
show :: GetRelationalDatabaseLogEventsResponse -> String
$cshow :: GetRelationalDatabaseLogEventsResponse -> String
showsPrec :: Int -> GetRelationalDatabaseLogEventsResponse -> ShowS
$cshowsPrec :: Int -> GetRelationalDatabaseLogEventsResponse -> ShowS
Prelude.Show, forall x.
Rep GetRelationalDatabaseLogEventsResponse x
-> GetRelationalDatabaseLogEventsResponse
forall x.
GetRelationalDatabaseLogEventsResponse
-> Rep GetRelationalDatabaseLogEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRelationalDatabaseLogEventsResponse x
-> GetRelationalDatabaseLogEventsResponse
$cfrom :: forall x.
GetRelationalDatabaseLogEventsResponse
-> Rep GetRelationalDatabaseLogEventsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetRelationalDatabaseLogEventsResponse' 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:
--
-- 'nextBackwardToken', 'getRelationalDatabaseLogEventsResponse_nextBackwardToken' - A token used for advancing to the previous page of results from your get
-- relational database log events request.
--
-- 'nextForwardToken', 'getRelationalDatabaseLogEventsResponse_nextForwardToken' - A token used for advancing to the next page of results from your get
-- relational database log events request.
--
-- 'resourceLogEvents', 'getRelationalDatabaseLogEventsResponse_resourceLogEvents' - An object describing the result of your get relational database log
-- events request.
--
-- 'httpStatus', 'getRelationalDatabaseLogEventsResponse_httpStatus' - The response's http status code.
newGetRelationalDatabaseLogEventsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetRelationalDatabaseLogEventsResponse
newGetRelationalDatabaseLogEventsResponse :: Int -> GetRelationalDatabaseLogEventsResponse
newGetRelationalDatabaseLogEventsResponse
  Int
pHttpStatus_ =
    GetRelationalDatabaseLogEventsResponse'
      { $sel:nextBackwardToken:GetRelationalDatabaseLogEventsResponse' :: Maybe Text
nextBackwardToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:nextForwardToken:GetRelationalDatabaseLogEventsResponse' :: Maybe Text
nextForwardToken = forall a. Maybe a
Prelude.Nothing,
        $sel:resourceLogEvents:GetRelationalDatabaseLogEventsResponse' :: Maybe [LogEvent]
resourceLogEvents = forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetRelationalDatabaseLogEventsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | A token used for advancing to the previous page of results from your get
-- relational database log events request.
getRelationalDatabaseLogEventsResponse_nextBackwardToken :: Lens.Lens' GetRelationalDatabaseLogEventsResponse (Prelude.Maybe Prelude.Text)
getRelationalDatabaseLogEventsResponse_nextBackwardToken :: Lens' GetRelationalDatabaseLogEventsResponse (Maybe Text)
getRelationalDatabaseLogEventsResponse_nextBackwardToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseLogEventsResponse' {Maybe Text
nextBackwardToken :: Maybe Text
$sel:nextBackwardToken:GetRelationalDatabaseLogEventsResponse' :: GetRelationalDatabaseLogEventsResponse -> Maybe Text
nextBackwardToken} -> Maybe Text
nextBackwardToken) (\s :: GetRelationalDatabaseLogEventsResponse
s@GetRelationalDatabaseLogEventsResponse' {} Maybe Text
a -> GetRelationalDatabaseLogEventsResponse
s {$sel:nextBackwardToken:GetRelationalDatabaseLogEventsResponse' :: Maybe Text
nextBackwardToken = Maybe Text
a} :: GetRelationalDatabaseLogEventsResponse)

-- | A token used for advancing to the next page of results from your get
-- relational database log events request.
getRelationalDatabaseLogEventsResponse_nextForwardToken :: Lens.Lens' GetRelationalDatabaseLogEventsResponse (Prelude.Maybe Prelude.Text)
getRelationalDatabaseLogEventsResponse_nextForwardToken :: Lens' GetRelationalDatabaseLogEventsResponse (Maybe Text)
getRelationalDatabaseLogEventsResponse_nextForwardToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseLogEventsResponse' {Maybe Text
nextForwardToken :: Maybe Text
$sel:nextForwardToken:GetRelationalDatabaseLogEventsResponse' :: GetRelationalDatabaseLogEventsResponse -> Maybe Text
nextForwardToken} -> Maybe Text
nextForwardToken) (\s :: GetRelationalDatabaseLogEventsResponse
s@GetRelationalDatabaseLogEventsResponse' {} Maybe Text
a -> GetRelationalDatabaseLogEventsResponse
s {$sel:nextForwardToken:GetRelationalDatabaseLogEventsResponse' :: Maybe Text
nextForwardToken = Maybe Text
a} :: GetRelationalDatabaseLogEventsResponse)

-- | An object describing the result of your get relational database log
-- events request.
getRelationalDatabaseLogEventsResponse_resourceLogEvents :: Lens.Lens' GetRelationalDatabaseLogEventsResponse (Prelude.Maybe [LogEvent])
getRelationalDatabaseLogEventsResponse_resourceLogEvents :: Lens' GetRelationalDatabaseLogEventsResponse (Maybe [LogEvent])
getRelationalDatabaseLogEventsResponse_resourceLogEvents = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseLogEventsResponse' {Maybe [LogEvent]
resourceLogEvents :: Maybe [LogEvent]
$sel:resourceLogEvents:GetRelationalDatabaseLogEventsResponse' :: GetRelationalDatabaseLogEventsResponse -> Maybe [LogEvent]
resourceLogEvents} -> Maybe [LogEvent]
resourceLogEvents) (\s :: GetRelationalDatabaseLogEventsResponse
s@GetRelationalDatabaseLogEventsResponse' {} Maybe [LogEvent]
a -> GetRelationalDatabaseLogEventsResponse
s {$sel:resourceLogEvents:GetRelationalDatabaseLogEventsResponse' :: Maybe [LogEvent]
resourceLogEvents = Maybe [LogEvent]
a} :: GetRelationalDatabaseLogEventsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetRelationalDatabaseLogEventsResponse
  where
  rnf :: GetRelationalDatabaseLogEventsResponse -> ()
rnf GetRelationalDatabaseLogEventsResponse' {Int
Maybe [LogEvent]
Maybe Text
httpStatus :: Int
resourceLogEvents :: Maybe [LogEvent]
nextForwardToken :: Maybe Text
nextBackwardToken :: Maybe Text
$sel:httpStatus:GetRelationalDatabaseLogEventsResponse' :: GetRelationalDatabaseLogEventsResponse -> Int
$sel:resourceLogEvents:GetRelationalDatabaseLogEventsResponse' :: GetRelationalDatabaseLogEventsResponse -> Maybe [LogEvent]
$sel:nextForwardToken:GetRelationalDatabaseLogEventsResponse' :: GetRelationalDatabaseLogEventsResponse -> Maybe Text
$sel:nextBackwardToken:GetRelationalDatabaseLogEventsResponse' :: GetRelationalDatabaseLogEventsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextBackwardToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextForwardToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [LogEvent]
resourceLogEvents
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus