{-# 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.GetRelationalDatabaseEvents
-- 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 events for a specific database in Amazon Lightsail.
--
-- This operation returns paginated results.
module Amazonka.Lightsail.GetRelationalDatabaseEvents
  ( -- * Creating a Request
    GetRelationalDatabaseEvents (..),
    newGetRelationalDatabaseEvents,

    -- * Request Lenses
    getRelationalDatabaseEvents_durationInMinutes,
    getRelationalDatabaseEvents_pageToken,
    getRelationalDatabaseEvents_relationalDatabaseName,

    -- * Destructuring the Response
    GetRelationalDatabaseEventsResponse (..),
    newGetRelationalDatabaseEventsResponse,

    -- * Response Lenses
    getRelationalDatabaseEventsResponse_nextPageToken,
    getRelationalDatabaseEventsResponse_relationalDatabaseEvents,
    getRelationalDatabaseEventsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetRelationalDatabaseEvents' smart constructor.
data GetRelationalDatabaseEvents = GetRelationalDatabaseEvents'
  { -- | The number of minutes in the past from which to retrieve events. For
    -- example, to get all events from the past 2 hours, enter 120.
    --
    -- Default: @60@
    --
    -- The minimum is 1 and the maximum is 14 days (20160 minutes).
    GetRelationalDatabaseEvents -> Maybe Int
durationInMinutes :: Prelude.Maybe Prelude.Int,
    -- | The token to advance to the next page of results from your request.
    --
    -- To get a page token, perform an initial @GetRelationalDatabaseEvents@
    -- request. If your results are paginated, the response will return a next
    -- page token that you can specify as the page token in a subsequent
    -- request.
    GetRelationalDatabaseEvents -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the database from which to get events.
    GetRelationalDatabaseEvents -> Text
relationalDatabaseName :: Prelude.Text
  }
  deriving (GetRelationalDatabaseEvents -> GetRelationalDatabaseEvents -> Bool
(GetRelationalDatabaseEvents
 -> GetRelationalDatabaseEvents -> Bool)
-> (GetRelationalDatabaseEvents
    -> GetRelationalDatabaseEvents -> Bool)
-> Eq GetRelationalDatabaseEvents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRelationalDatabaseEvents -> GetRelationalDatabaseEvents -> Bool
$c/= :: GetRelationalDatabaseEvents -> GetRelationalDatabaseEvents -> Bool
== :: GetRelationalDatabaseEvents -> GetRelationalDatabaseEvents -> Bool
$c== :: GetRelationalDatabaseEvents -> GetRelationalDatabaseEvents -> Bool
Prelude.Eq, ReadPrec [GetRelationalDatabaseEvents]
ReadPrec GetRelationalDatabaseEvents
Int -> ReadS GetRelationalDatabaseEvents
ReadS [GetRelationalDatabaseEvents]
(Int -> ReadS GetRelationalDatabaseEvents)
-> ReadS [GetRelationalDatabaseEvents]
-> ReadPrec GetRelationalDatabaseEvents
-> ReadPrec [GetRelationalDatabaseEvents]
-> Read GetRelationalDatabaseEvents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRelationalDatabaseEvents]
$creadListPrec :: ReadPrec [GetRelationalDatabaseEvents]
readPrec :: ReadPrec GetRelationalDatabaseEvents
$creadPrec :: ReadPrec GetRelationalDatabaseEvents
readList :: ReadS [GetRelationalDatabaseEvents]
$creadList :: ReadS [GetRelationalDatabaseEvents]
readsPrec :: Int -> ReadS GetRelationalDatabaseEvents
$creadsPrec :: Int -> ReadS GetRelationalDatabaseEvents
Prelude.Read, Int -> GetRelationalDatabaseEvents -> ShowS
[GetRelationalDatabaseEvents] -> ShowS
GetRelationalDatabaseEvents -> String
(Int -> GetRelationalDatabaseEvents -> ShowS)
-> (GetRelationalDatabaseEvents -> String)
-> ([GetRelationalDatabaseEvents] -> ShowS)
-> Show GetRelationalDatabaseEvents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRelationalDatabaseEvents] -> ShowS
$cshowList :: [GetRelationalDatabaseEvents] -> ShowS
show :: GetRelationalDatabaseEvents -> String
$cshow :: GetRelationalDatabaseEvents -> String
showsPrec :: Int -> GetRelationalDatabaseEvents -> ShowS
$cshowsPrec :: Int -> GetRelationalDatabaseEvents -> ShowS
Prelude.Show, (forall x.
 GetRelationalDatabaseEvents -> Rep GetRelationalDatabaseEvents x)
-> (forall x.
    Rep GetRelationalDatabaseEvents x -> GetRelationalDatabaseEvents)
-> Generic GetRelationalDatabaseEvents
forall x.
Rep GetRelationalDatabaseEvents x -> GetRelationalDatabaseEvents
forall x.
GetRelationalDatabaseEvents -> Rep GetRelationalDatabaseEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRelationalDatabaseEvents x -> GetRelationalDatabaseEvents
$cfrom :: forall x.
GetRelationalDatabaseEvents -> Rep GetRelationalDatabaseEvents x
Prelude.Generic)

-- |
-- Create a value of 'GetRelationalDatabaseEvents' 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:
--
-- 'durationInMinutes', 'getRelationalDatabaseEvents_durationInMinutes' - The number of minutes in the past from which to retrieve events. For
-- example, to get all events from the past 2 hours, enter 120.
--
-- Default: @60@
--
-- The minimum is 1 and the maximum is 14 days (20160 minutes).
--
-- 'pageToken', 'getRelationalDatabaseEvents_pageToken' - The token to advance to the next page of results from your request.
--
-- To get a page token, perform an initial @GetRelationalDatabaseEvents@
-- request. If your results are paginated, the response will return a next
-- page token that you can specify as the page token in a subsequent
-- request.
--
-- 'relationalDatabaseName', 'getRelationalDatabaseEvents_relationalDatabaseName' - The name of the database from which to get events.
newGetRelationalDatabaseEvents ::
  -- | 'relationalDatabaseName'
  Prelude.Text ->
  GetRelationalDatabaseEvents
newGetRelationalDatabaseEvents :: Text -> GetRelationalDatabaseEvents
newGetRelationalDatabaseEvents
  Text
pRelationalDatabaseName_ =
    GetRelationalDatabaseEvents' :: Maybe Int -> Maybe Text -> Text -> GetRelationalDatabaseEvents
GetRelationalDatabaseEvents'
      { $sel:durationInMinutes:GetRelationalDatabaseEvents' :: Maybe Int
durationInMinutes =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:pageToken:GetRelationalDatabaseEvents' :: Maybe Text
pageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:relationalDatabaseName:GetRelationalDatabaseEvents' :: Text
relationalDatabaseName =
          Text
pRelationalDatabaseName_
      }

-- | The number of minutes in the past from which to retrieve events. For
-- example, to get all events from the past 2 hours, enter 120.
--
-- Default: @60@
--
-- The minimum is 1 and the maximum is 14 days (20160 minutes).
getRelationalDatabaseEvents_durationInMinutes :: Lens.Lens' GetRelationalDatabaseEvents (Prelude.Maybe Prelude.Int)
getRelationalDatabaseEvents_durationInMinutes :: (Maybe Int -> f (Maybe Int))
-> GetRelationalDatabaseEvents -> f GetRelationalDatabaseEvents
getRelationalDatabaseEvents_durationInMinutes = (GetRelationalDatabaseEvents -> Maybe Int)
-> (GetRelationalDatabaseEvents
    -> Maybe Int -> GetRelationalDatabaseEvents)
-> Lens
     GetRelationalDatabaseEvents
     GetRelationalDatabaseEvents
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseEvents' {Maybe Int
durationInMinutes :: Maybe Int
$sel:durationInMinutes:GetRelationalDatabaseEvents' :: GetRelationalDatabaseEvents -> Maybe Int
durationInMinutes} -> Maybe Int
durationInMinutes) (\s :: GetRelationalDatabaseEvents
s@GetRelationalDatabaseEvents' {} Maybe Int
a -> GetRelationalDatabaseEvents
s {$sel:durationInMinutes:GetRelationalDatabaseEvents' :: Maybe Int
durationInMinutes = Maybe Int
a} :: GetRelationalDatabaseEvents)

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

-- | The name of the database from which to get events.
getRelationalDatabaseEvents_relationalDatabaseName :: Lens.Lens' GetRelationalDatabaseEvents Prelude.Text
getRelationalDatabaseEvents_relationalDatabaseName :: (Text -> f Text)
-> GetRelationalDatabaseEvents -> f GetRelationalDatabaseEvents
getRelationalDatabaseEvents_relationalDatabaseName = (GetRelationalDatabaseEvents -> Text)
-> (GetRelationalDatabaseEvents
    -> Text -> GetRelationalDatabaseEvents)
-> Lens
     GetRelationalDatabaseEvents GetRelationalDatabaseEvents Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseEvents' {Text
relationalDatabaseName :: Text
$sel:relationalDatabaseName:GetRelationalDatabaseEvents' :: GetRelationalDatabaseEvents -> Text
relationalDatabaseName} -> Text
relationalDatabaseName) (\s :: GetRelationalDatabaseEvents
s@GetRelationalDatabaseEvents' {} Text
a -> GetRelationalDatabaseEvents
s {$sel:relationalDatabaseName:GetRelationalDatabaseEvents' :: Text
relationalDatabaseName = Text
a} :: GetRelationalDatabaseEvents)

instance Core.AWSPager GetRelationalDatabaseEvents where
  page :: GetRelationalDatabaseEvents
-> AWSResponse GetRelationalDatabaseEvents
-> Maybe GetRelationalDatabaseEvents
page GetRelationalDatabaseEvents
rq AWSResponse GetRelationalDatabaseEvents
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetRelationalDatabaseEvents
GetRelationalDatabaseEventsResponse
rs
            GetRelationalDatabaseEventsResponse
-> Getting (First Text) GetRelationalDatabaseEventsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetRelationalDatabaseEventsResponse
-> Const (First Text) GetRelationalDatabaseEventsResponse
Lens' GetRelationalDatabaseEventsResponse (Maybe Text)
getRelationalDatabaseEventsResponse_nextPageToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetRelationalDatabaseEventsResponse
 -> Const (First Text) GetRelationalDatabaseEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetRelationalDatabaseEventsResponse 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 GetRelationalDatabaseEvents
forall a. Maybe a
Prelude.Nothing
    | Maybe [RelationalDatabaseEvent] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetRelationalDatabaseEvents
GetRelationalDatabaseEventsResponse
rs
            GetRelationalDatabaseEventsResponse
-> Getting
     (First [RelationalDatabaseEvent])
     GetRelationalDatabaseEventsResponse
     [RelationalDatabaseEvent]
-> Maybe [RelationalDatabaseEvent]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RelationalDatabaseEvent]
 -> Const
      (First [RelationalDatabaseEvent])
      (Maybe [RelationalDatabaseEvent]))
-> GetRelationalDatabaseEventsResponse
-> Const
     (First [RelationalDatabaseEvent])
     GetRelationalDatabaseEventsResponse
Lens'
  GetRelationalDatabaseEventsResponse
  (Maybe [RelationalDatabaseEvent])
getRelationalDatabaseEventsResponse_relationalDatabaseEvents
              ((Maybe [RelationalDatabaseEvent]
  -> Const
       (First [RelationalDatabaseEvent])
       (Maybe [RelationalDatabaseEvent]))
 -> GetRelationalDatabaseEventsResponse
 -> Const
      (First [RelationalDatabaseEvent])
      GetRelationalDatabaseEventsResponse)
-> (([RelationalDatabaseEvent]
     -> Const
          (First [RelationalDatabaseEvent]) [RelationalDatabaseEvent])
    -> Maybe [RelationalDatabaseEvent]
    -> Const
         (First [RelationalDatabaseEvent])
         (Maybe [RelationalDatabaseEvent]))
-> Getting
     (First [RelationalDatabaseEvent])
     GetRelationalDatabaseEventsResponse
     [RelationalDatabaseEvent]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RelationalDatabaseEvent]
 -> Const
      (First [RelationalDatabaseEvent]) [RelationalDatabaseEvent])
-> Maybe [RelationalDatabaseEvent]
-> Const
     (First [RelationalDatabaseEvent]) (Maybe [RelationalDatabaseEvent])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetRelationalDatabaseEvents
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetRelationalDatabaseEvents -> Maybe GetRelationalDatabaseEvents
forall a. a -> Maybe a
Prelude.Just (GetRelationalDatabaseEvents -> Maybe GetRelationalDatabaseEvents)
-> GetRelationalDatabaseEvents -> Maybe GetRelationalDatabaseEvents
forall a b. (a -> b) -> a -> b
Prelude.$
        GetRelationalDatabaseEvents
rq
          GetRelationalDatabaseEvents
-> (GetRelationalDatabaseEvents -> GetRelationalDatabaseEvents)
-> GetRelationalDatabaseEvents
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetRelationalDatabaseEvents
-> Identity GetRelationalDatabaseEvents
Lens
  GetRelationalDatabaseEvents
  GetRelationalDatabaseEvents
  (Maybe Text)
  (Maybe Text)
getRelationalDatabaseEvents_pageToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetRelationalDatabaseEvents
 -> Identity GetRelationalDatabaseEvents)
-> Maybe Text
-> GetRelationalDatabaseEvents
-> GetRelationalDatabaseEvents
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetRelationalDatabaseEvents
GetRelationalDatabaseEventsResponse
rs
          GetRelationalDatabaseEventsResponse
-> Getting (First Text) GetRelationalDatabaseEventsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetRelationalDatabaseEventsResponse
-> Const (First Text) GetRelationalDatabaseEventsResponse
Lens' GetRelationalDatabaseEventsResponse (Maybe Text)
getRelationalDatabaseEventsResponse_nextPageToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetRelationalDatabaseEventsResponse
 -> Const (First Text) GetRelationalDatabaseEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetRelationalDatabaseEventsResponse 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 GetRelationalDatabaseEvents where
  type
    AWSResponse GetRelationalDatabaseEvents =
      GetRelationalDatabaseEventsResponse
  request :: GetRelationalDatabaseEvents -> Request GetRelationalDatabaseEvents
request = Service
-> GetRelationalDatabaseEvents
-> Request GetRelationalDatabaseEvents
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetRelationalDatabaseEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRelationalDatabaseEvents)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetRelationalDatabaseEvents))
-> Logger
-> Service
-> Proxy GetRelationalDatabaseEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRelationalDatabaseEvents)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [RelationalDatabaseEvent]
-> Int
-> GetRelationalDatabaseEventsResponse
GetRelationalDatabaseEventsResponse'
            (Maybe Text
 -> Maybe [RelationalDatabaseEvent]
 -> Int
 -> GetRelationalDatabaseEventsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [RelationalDatabaseEvent]
      -> Int -> GetRelationalDatabaseEventsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextPageToken")
            Either
  String
  (Maybe [RelationalDatabaseEvent]
   -> Int -> GetRelationalDatabaseEventsResponse)
-> Either String (Maybe [RelationalDatabaseEvent])
-> Either String (Int -> GetRelationalDatabaseEventsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [RelationalDatabaseEvent]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"relationalDatabaseEvents"
                            Either String (Maybe (Maybe [RelationalDatabaseEvent]))
-> Maybe [RelationalDatabaseEvent]
-> Either String (Maybe [RelationalDatabaseEvent])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RelationalDatabaseEvent]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> GetRelationalDatabaseEventsResponse)
-> Either String Int
-> Either String GetRelationalDatabaseEventsResponse
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 GetRelationalDatabaseEvents

instance Prelude.NFData GetRelationalDatabaseEvents

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

instance Core.ToJSON GetRelationalDatabaseEvents where
  toJSON :: GetRelationalDatabaseEvents -> Value
toJSON GetRelationalDatabaseEvents' {Maybe Int
Maybe Text
Text
relationalDatabaseName :: Text
pageToken :: Maybe Text
durationInMinutes :: Maybe Int
$sel:relationalDatabaseName:GetRelationalDatabaseEvents' :: GetRelationalDatabaseEvents -> Text
$sel:pageToken:GetRelationalDatabaseEvents' :: GetRelationalDatabaseEvents -> Maybe Text
$sel:durationInMinutes:GetRelationalDatabaseEvents' :: GetRelationalDatabaseEvents -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"durationInMinutes" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
durationInMinutes,
            (Text
"pageToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
pageToken,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"relationalDatabaseName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
relationalDatabaseName
              )
          ]
      )

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

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

-- | /See:/ 'newGetRelationalDatabaseEventsResponse' smart constructor.
data GetRelationalDatabaseEventsResponse = GetRelationalDatabaseEventsResponse'
  { -- | The token to advance to the next page of results from your request.
    --
    -- A next page token is not returned if there are no more results to
    -- display.
    --
    -- To get the next page of results, perform another
    -- @GetRelationalDatabaseEvents@ request and specify the next page token
    -- using the @pageToken@ parameter.
    GetRelationalDatabaseEventsResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | An object describing the result of your get relational database events
    -- request.
    GetRelationalDatabaseEventsResponse
-> Maybe [RelationalDatabaseEvent]
relationalDatabaseEvents :: Prelude.Maybe [RelationalDatabaseEvent],
    -- | The response's http status code.
    GetRelationalDatabaseEventsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetRelationalDatabaseEventsResponse
-> GetRelationalDatabaseEventsResponse -> Bool
(GetRelationalDatabaseEventsResponse
 -> GetRelationalDatabaseEventsResponse -> Bool)
-> (GetRelationalDatabaseEventsResponse
    -> GetRelationalDatabaseEventsResponse -> Bool)
-> Eq GetRelationalDatabaseEventsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRelationalDatabaseEventsResponse
-> GetRelationalDatabaseEventsResponse -> Bool
$c/= :: GetRelationalDatabaseEventsResponse
-> GetRelationalDatabaseEventsResponse -> Bool
== :: GetRelationalDatabaseEventsResponse
-> GetRelationalDatabaseEventsResponse -> Bool
$c== :: GetRelationalDatabaseEventsResponse
-> GetRelationalDatabaseEventsResponse -> Bool
Prelude.Eq, ReadPrec [GetRelationalDatabaseEventsResponse]
ReadPrec GetRelationalDatabaseEventsResponse
Int -> ReadS GetRelationalDatabaseEventsResponse
ReadS [GetRelationalDatabaseEventsResponse]
(Int -> ReadS GetRelationalDatabaseEventsResponse)
-> ReadS [GetRelationalDatabaseEventsResponse]
-> ReadPrec GetRelationalDatabaseEventsResponse
-> ReadPrec [GetRelationalDatabaseEventsResponse]
-> Read GetRelationalDatabaseEventsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRelationalDatabaseEventsResponse]
$creadListPrec :: ReadPrec [GetRelationalDatabaseEventsResponse]
readPrec :: ReadPrec GetRelationalDatabaseEventsResponse
$creadPrec :: ReadPrec GetRelationalDatabaseEventsResponse
readList :: ReadS [GetRelationalDatabaseEventsResponse]
$creadList :: ReadS [GetRelationalDatabaseEventsResponse]
readsPrec :: Int -> ReadS GetRelationalDatabaseEventsResponse
$creadsPrec :: Int -> ReadS GetRelationalDatabaseEventsResponse
Prelude.Read, Int -> GetRelationalDatabaseEventsResponse -> ShowS
[GetRelationalDatabaseEventsResponse] -> ShowS
GetRelationalDatabaseEventsResponse -> String
(Int -> GetRelationalDatabaseEventsResponse -> ShowS)
-> (GetRelationalDatabaseEventsResponse -> String)
-> ([GetRelationalDatabaseEventsResponse] -> ShowS)
-> Show GetRelationalDatabaseEventsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRelationalDatabaseEventsResponse] -> ShowS
$cshowList :: [GetRelationalDatabaseEventsResponse] -> ShowS
show :: GetRelationalDatabaseEventsResponse -> String
$cshow :: GetRelationalDatabaseEventsResponse -> String
showsPrec :: Int -> GetRelationalDatabaseEventsResponse -> ShowS
$cshowsPrec :: Int -> GetRelationalDatabaseEventsResponse -> ShowS
Prelude.Show, (forall x.
 GetRelationalDatabaseEventsResponse
 -> Rep GetRelationalDatabaseEventsResponse x)
-> (forall x.
    Rep GetRelationalDatabaseEventsResponse x
    -> GetRelationalDatabaseEventsResponse)
-> Generic GetRelationalDatabaseEventsResponse
forall x.
Rep GetRelationalDatabaseEventsResponse x
-> GetRelationalDatabaseEventsResponse
forall x.
GetRelationalDatabaseEventsResponse
-> Rep GetRelationalDatabaseEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRelationalDatabaseEventsResponse x
-> GetRelationalDatabaseEventsResponse
$cfrom :: forall x.
GetRelationalDatabaseEventsResponse
-> Rep GetRelationalDatabaseEventsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetRelationalDatabaseEventsResponse' 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:
--
-- 'nextPageToken', 'getRelationalDatabaseEventsResponse_nextPageToken' - The token to advance to the next page of results from your request.
--
-- A next page token is not returned if there are no more results to
-- display.
--
-- To get the next page of results, perform another
-- @GetRelationalDatabaseEvents@ request and specify the next page token
-- using the @pageToken@ parameter.
--
-- 'relationalDatabaseEvents', 'getRelationalDatabaseEventsResponse_relationalDatabaseEvents' - An object describing the result of your get relational database events
-- request.
--
-- 'httpStatus', 'getRelationalDatabaseEventsResponse_httpStatus' - The response's http status code.
newGetRelationalDatabaseEventsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetRelationalDatabaseEventsResponse
newGetRelationalDatabaseEventsResponse :: Int -> GetRelationalDatabaseEventsResponse
newGetRelationalDatabaseEventsResponse Int
pHttpStatus_ =
  GetRelationalDatabaseEventsResponse' :: Maybe Text
-> Maybe [RelationalDatabaseEvent]
-> Int
-> GetRelationalDatabaseEventsResponse
GetRelationalDatabaseEventsResponse'
    { $sel:nextPageToken:GetRelationalDatabaseEventsResponse' :: Maybe Text
nextPageToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:relationalDatabaseEvents:GetRelationalDatabaseEventsResponse' :: Maybe [RelationalDatabaseEvent]
relationalDatabaseEvents =
        Maybe [RelationalDatabaseEvent]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetRelationalDatabaseEventsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to advance to the next page of results from your request.
--
-- A next page token is not returned if there are no more results to
-- display.
--
-- To get the next page of results, perform another
-- @GetRelationalDatabaseEvents@ request and specify the next page token
-- using the @pageToken@ parameter.
getRelationalDatabaseEventsResponse_nextPageToken :: Lens.Lens' GetRelationalDatabaseEventsResponse (Prelude.Maybe Prelude.Text)
getRelationalDatabaseEventsResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> GetRelationalDatabaseEventsResponse
-> f GetRelationalDatabaseEventsResponse
getRelationalDatabaseEventsResponse_nextPageToken = (GetRelationalDatabaseEventsResponse -> Maybe Text)
-> (GetRelationalDatabaseEventsResponse
    -> Maybe Text -> GetRelationalDatabaseEventsResponse)
-> Lens' GetRelationalDatabaseEventsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRelationalDatabaseEventsResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetRelationalDatabaseEventsResponse' :: GetRelationalDatabaseEventsResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetRelationalDatabaseEventsResponse
s@GetRelationalDatabaseEventsResponse' {} Maybe Text
a -> GetRelationalDatabaseEventsResponse
s {$sel:nextPageToken:GetRelationalDatabaseEventsResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetRelationalDatabaseEventsResponse)

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

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

instance
  Prelude.NFData
    GetRelationalDatabaseEventsResponse