{-# 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.Redshift.DescribeTableRestoreStatus
-- 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)
--
-- Lists the status of one or more table restore requests made using the
-- RestoreTableFromClusterSnapshot API action. If you don\'t specify a
-- value for the @TableRestoreRequestId@ parameter, then
-- @DescribeTableRestoreStatus@ returns the status of all table restore
-- requests ordered by the date and time of the request in ascending order.
-- Otherwise @DescribeTableRestoreStatus@ returns the status of the table
-- specified by @TableRestoreRequestId@.
--
-- This operation returns paginated results.
module Amazonka.Redshift.DescribeTableRestoreStatus
  ( -- * Creating a Request
    DescribeTableRestoreStatus (..),
    newDescribeTableRestoreStatus,

    -- * Request Lenses
    describeTableRestoreStatus_tableRestoreRequestId,
    describeTableRestoreStatus_clusterIdentifier,
    describeTableRestoreStatus_marker,
    describeTableRestoreStatus_maxRecords,

    -- * Destructuring the Response
    DescribeTableRestoreStatusResponse (..),
    newDescribeTableRestoreStatusResponse,

    -- * Response Lenses
    describeTableRestoreStatusResponse_marker,
    describeTableRestoreStatusResponse_tableRestoreStatusDetails,
    describeTableRestoreStatusResponse_httpStatus,
  )
where

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

-- |
--
-- /See:/ 'newDescribeTableRestoreStatus' smart constructor.
data DescribeTableRestoreStatus = DescribeTableRestoreStatus'
  { -- | The identifier of the table restore request to return status for. If you
    -- don\'t specify a @TableRestoreRequestId@ value, then
    -- @DescribeTableRestoreStatus@ returns the status of all in-progress table
    -- restore requests.
    DescribeTableRestoreStatus -> Maybe Text
tableRestoreRequestId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Redshift cluster that the table is being restored to.
    DescribeTableRestoreStatus -> Maybe Text
clusterIdentifier :: Prelude.Maybe Prelude.Text,
    -- | An optional pagination token provided by a previous
    -- @DescribeTableRestoreStatus@ request. If this parameter is specified,
    -- the response includes only records beyond the marker, up to the value
    -- specified by the @MaxRecords@ parameter.
    DescribeTableRestoreStatus -> 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 that the remaining
    -- results can be retrieved.
    DescribeTableRestoreStatus -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int
  }
  deriving (DescribeTableRestoreStatus -> DescribeTableRestoreStatus -> Bool
(DescribeTableRestoreStatus -> DescribeTableRestoreStatus -> Bool)
-> (DescribeTableRestoreStatus
    -> DescribeTableRestoreStatus -> Bool)
-> Eq DescribeTableRestoreStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTableRestoreStatus -> DescribeTableRestoreStatus -> Bool
$c/= :: DescribeTableRestoreStatus -> DescribeTableRestoreStatus -> Bool
== :: DescribeTableRestoreStatus -> DescribeTableRestoreStatus -> Bool
$c== :: DescribeTableRestoreStatus -> DescribeTableRestoreStatus -> Bool
Prelude.Eq, ReadPrec [DescribeTableRestoreStatus]
ReadPrec DescribeTableRestoreStatus
Int -> ReadS DescribeTableRestoreStatus
ReadS [DescribeTableRestoreStatus]
(Int -> ReadS DescribeTableRestoreStatus)
-> ReadS [DescribeTableRestoreStatus]
-> ReadPrec DescribeTableRestoreStatus
-> ReadPrec [DescribeTableRestoreStatus]
-> Read DescribeTableRestoreStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTableRestoreStatus]
$creadListPrec :: ReadPrec [DescribeTableRestoreStatus]
readPrec :: ReadPrec DescribeTableRestoreStatus
$creadPrec :: ReadPrec DescribeTableRestoreStatus
readList :: ReadS [DescribeTableRestoreStatus]
$creadList :: ReadS [DescribeTableRestoreStatus]
readsPrec :: Int -> ReadS DescribeTableRestoreStatus
$creadsPrec :: Int -> ReadS DescribeTableRestoreStatus
Prelude.Read, Int -> DescribeTableRestoreStatus -> ShowS
[DescribeTableRestoreStatus] -> ShowS
DescribeTableRestoreStatus -> String
(Int -> DescribeTableRestoreStatus -> ShowS)
-> (DescribeTableRestoreStatus -> String)
-> ([DescribeTableRestoreStatus] -> ShowS)
-> Show DescribeTableRestoreStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTableRestoreStatus] -> ShowS
$cshowList :: [DescribeTableRestoreStatus] -> ShowS
show :: DescribeTableRestoreStatus -> String
$cshow :: DescribeTableRestoreStatus -> String
showsPrec :: Int -> DescribeTableRestoreStatus -> ShowS
$cshowsPrec :: Int -> DescribeTableRestoreStatus -> ShowS
Prelude.Show, (forall x.
 DescribeTableRestoreStatus -> Rep DescribeTableRestoreStatus x)
-> (forall x.
    Rep DescribeTableRestoreStatus x -> DescribeTableRestoreStatus)
-> Generic DescribeTableRestoreStatus
forall x.
Rep DescribeTableRestoreStatus x -> DescribeTableRestoreStatus
forall x.
DescribeTableRestoreStatus -> Rep DescribeTableRestoreStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTableRestoreStatus x -> DescribeTableRestoreStatus
$cfrom :: forall x.
DescribeTableRestoreStatus -> Rep DescribeTableRestoreStatus x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTableRestoreStatus' 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:
--
-- 'tableRestoreRequestId', 'describeTableRestoreStatus_tableRestoreRequestId' - The identifier of the table restore request to return status for. If you
-- don\'t specify a @TableRestoreRequestId@ value, then
-- @DescribeTableRestoreStatus@ returns the status of all in-progress table
-- restore requests.
--
-- 'clusterIdentifier', 'describeTableRestoreStatus_clusterIdentifier' - The Amazon Redshift cluster that the table is being restored to.
--
-- 'marker', 'describeTableRestoreStatus_marker' - An optional pagination token provided by a previous
-- @DescribeTableRestoreStatus@ request. If this parameter is specified,
-- the response includes only records beyond the marker, up to the value
-- specified by the @MaxRecords@ parameter.
--
-- 'maxRecords', 'describeTableRestoreStatus_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 that the remaining
-- results can be retrieved.
newDescribeTableRestoreStatus ::
  DescribeTableRestoreStatus
newDescribeTableRestoreStatus :: DescribeTableRestoreStatus
newDescribeTableRestoreStatus =
  DescribeTableRestoreStatus' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> DescribeTableRestoreStatus
DescribeTableRestoreStatus'
    { $sel:tableRestoreRequestId:DescribeTableRestoreStatus' :: Maybe Text
tableRestoreRequestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:clusterIdentifier:DescribeTableRestoreStatus' :: Maybe Text
clusterIdentifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeTableRestoreStatus' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeTableRestoreStatus' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the table restore request to return status for. If you
-- don\'t specify a @TableRestoreRequestId@ value, then
-- @DescribeTableRestoreStatus@ returns the status of all in-progress table
-- restore requests.
describeTableRestoreStatus_tableRestoreRequestId :: Lens.Lens' DescribeTableRestoreStatus (Prelude.Maybe Prelude.Text)
describeTableRestoreStatus_tableRestoreRequestId :: (Maybe Text -> f (Maybe Text))
-> DescribeTableRestoreStatus -> f DescribeTableRestoreStatus
describeTableRestoreStatus_tableRestoreRequestId = (DescribeTableRestoreStatus -> Maybe Text)
-> (DescribeTableRestoreStatus
    -> Maybe Text -> DescribeTableRestoreStatus)
-> Lens
     DescribeTableRestoreStatus
     DescribeTableRestoreStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableRestoreStatus' {Maybe Text
tableRestoreRequestId :: Maybe Text
$sel:tableRestoreRequestId:DescribeTableRestoreStatus' :: DescribeTableRestoreStatus -> Maybe Text
tableRestoreRequestId} -> Maybe Text
tableRestoreRequestId) (\s :: DescribeTableRestoreStatus
s@DescribeTableRestoreStatus' {} Maybe Text
a -> DescribeTableRestoreStatus
s {$sel:tableRestoreRequestId:DescribeTableRestoreStatus' :: Maybe Text
tableRestoreRequestId = Maybe Text
a} :: DescribeTableRestoreStatus)

-- | The Amazon Redshift cluster that the table is being restored to.
describeTableRestoreStatus_clusterIdentifier :: Lens.Lens' DescribeTableRestoreStatus (Prelude.Maybe Prelude.Text)
describeTableRestoreStatus_clusterIdentifier :: (Maybe Text -> f (Maybe Text))
-> DescribeTableRestoreStatus -> f DescribeTableRestoreStatus
describeTableRestoreStatus_clusterIdentifier = (DescribeTableRestoreStatus -> Maybe Text)
-> (DescribeTableRestoreStatus
    -> Maybe Text -> DescribeTableRestoreStatus)
-> Lens
     DescribeTableRestoreStatus
     DescribeTableRestoreStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableRestoreStatus' {Maybe Text
clusterIdentifier :: Maybe Text
$sel:clusterIdentifier:DescribeTableRestoreStatus' :: DescribeTableRestoreStatus -> Maybe Text
clusterIdentifier} -> Maybe Text
clusterIdentifier) (\s :: DescribeTableRestoreStatus
s@DescribeTableRestoreStatus' {} Maybe Text
a -> DescribeTableRestoreStatus
s {$sel:clusterIdentifier:DescribeTableRestoreStatus' :: Maybe Text
clusterIdentifier = Maybe Text
a} :: DescribeTableRestoreStatus)

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

-- | 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 that the remaining
-- results can be retrieved.
describeTableRestoreStatus_maxRecords :: Lens.Lens' DescribeTableRestoreStatus (Prelude.Maybe Prelude.Int)
describeTableRestoreStatus_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeTableRestoreStatus -> f DescribeTableRestoreStatus
describeTableRestoreStatus_maxRecords = (DescribeTableRestoreStatus -> Maybe Int)
-> (DescribeTableRestoreStatus
    -> Maybe Int -> DescribeTableRestoreStatus)
-> Lens
     DescribeTableRestoreStatus
     DescribeTableRestoreStatus
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableRestoreStatus' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeTableRestoreStatus' :: DescribeTableRestoreStatus -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeTableRestoreStatus
s@DescribeTableRestoreStatus' {} Maybe Int
a -> DescribeTableRestoreStatus
s {$sel:maxRecords:DescribeTableRestoreStatus' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeTableRestoreStatus)

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

instance Prelude.NFData DescribeTableRestoreStatus

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

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

instance Core.ToQuery DescribeTableRestoreStatus where
  toQuery :: DescribeTableRestoreStatus -> QueryString
toQuery DescribeTableRestoreStatus' {Maybe Int
Maybe Text
maxRecords :: Maybe Int
marker :: Maybe Text
clusterIdentifier :: Maybe Text
tableRestoreRequestId :: Maybe Text
$sel:maxRecords:DescribeTableRestoreStatus' :: DescribeTableRestoreStatus -> Maybe Int
$sel:marker:DescribeTableRestoreStatus' :: DescribeTableRestoreStatus -> Maybe Text
$sel:clusterIdentifier:DescribeTableRestoreStatus' :: DescribeTableRestoreStatus -> Maybe Text
$sel:tableRestoreRequestId:DescribeTableRestoreStatus' :: DescribeTableRestoreStatus -> 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
"DescribeTableRestoreStatus" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"TableRestoreRequestId"
          ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
tableRestoreRequestId,
        ByteString
"ClusterIdentifier" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clusterIdentifier,
        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
      ]

-- |
--
-- /See:/ 'newDescribeTableRestoreStatusResponse' smart constructor.
data DescribeTableRestoreStatusResponse = DescribeTableRestoreStatusResponse'
  { -- | A pagination token that can be used in a subsequent
    -- DescribeTableRestoreStatus request.
    DescribeTableRestoreStatusResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A list of status details for one or more table restore requests.
    DescribeTableRestoreStatusResponse -> Maybe [TableRestoreStatus]
tableRestoreStatusDetails :: Prelude.Maybe [TableRestoreStatus],
    -- | The response's http status code.
    DescribeTableRestoreStatusResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeTableRestoreStatusResponse
-> DescribeTableRestoreStatusResponse -> Bool
(DescribeTableRestoreStatusResponse
 -> DescribeTableRestoreStatusResponse -> Bool)
-> (DescribeTableRestoreStatusResponse
    -> DescribeTableRestoreStatusResponse -> Bool)
-> Eq DescribeTableRestoreStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTableRestoreStatusResponse
-> DescribeTableRestoreStatusResponse -> Bool
$c/= :: DescribeTableRestoreStatusResponse
-> DescribeTableRestoreStatusResponse -> Bool
== :: DescribeTableRestoreStatusResponse
-> DescribeTableRestoreStatusResponse -> Bool
$c== :: DescribeTableRestoreStatusResponse
-> DescribeTableRestoreStatusResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTableRestoreStatusResponse]
ReadPrec DescribeTableRestoreStatusResponse
Int -> ReadS DescribeTableRestoreStatusResponse
ReadS [DescribeTableRestoreStatusResponse]
(Int -> ReadS DescribeTableRestoreStatusResponse)
-> ReadS [DescribeTableRestoreStatusResponse]
-> ReadPrec DescribeTableRestoreStatusResponse
-> ReadPrec [DescribeTableRestoreStatusResponse]
-> Read DescribeTableRestoreStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTableRestoreStatusResponse]
$creadListPrec :: ReadPrec [DescribeTableRestoreStatusResponse]
readPrec :: ReadPrec DescribeTableRestoreStatusResponse
$creadPrec :: ReadPrec DescribeTableRestoreStatusResponse
readList :: ReadS [DescribeTableRestoreStatusResponse]
$creadList :: ReadS [DescribeTableRestoreStatusResponse]
readsPrec :: Int -> ReadS DescribeTableRestoreStatusResponse
$creadsPrec :: Int -> ReadS DescribeTableRestoreStatusResponse
Prelude.Read, Int -> DescribeTableRestoreStatusResponse -> ShowS
[DescribeTableRestoreStatusResponse] -> ShowS
DescribeTableRestoreStatusResponse -> String
(Int -> DescribeTableRestoreStatusResponse -> ShowS)
-> (DescribeTableRestoreStatusResponse -> String)
-> ([DescribeTableRestoreStatusResponse] -> ShowS)
-> Show DescribeTableRestoreStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTableRestoreStatusResponse] -> ShowS
$cshowList :: [DescribeTableRestoreStatusResponse] -> ShowS
show :: DescribeTableRestoreStatusResponse -> String
$cshow :: DescribeTableRestoreStatusResponse -> String
showsPrec :: Int -> DescribeTableRestoreStatusResponse -> ShowS
$cshowsPrec :: Int -> DescribeTableRestoreStatusResponse -> ShowS
Prelude.Show, (forall x.
 DescribeTableRestoreStatusResponse
 -> Rep DescribeTableRestoreStatusResponse x)
-> (forall x.
    Rep DescribeTableRestoreStatusResponse x
    -> DescribeTableRestoreStatusResponse)
-> Generic DescribeTableRestoreStatusResponse
forall x.
Rep DescribeTableRestoreStatusResponse x
-> DescribeTableRestoreStatusResponse
forall x.
DescribeTableRestoreStatusResponse
-> Rep DescribeTableRestoreStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTableRestoreStatusResponse x
-> DescribeTableRestoreStatusResponse
$cfrom :: forall x.
DescribeTableRestoreStatusResponse
-> Rep DescribeTableRestoreStatusResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTableRestoreStatusResponse' 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:
--
-- 'marker', 'describeTableRestoreStatusResponse_marker' - A pagination token that can be used in a subsequent
-- DescribeTableRestoreStatus request.
--
-- 'tableRestoreStatusDetails', 'describeTableRestoreStatusResponse_tableRestoreStatusDetails' - A list of status details for one or more table restore requests.
--
-- 'httpStatus', 'describeTableRestoreStatusResponse_httpStatus' - The response's http status code.
newDescribeTableRestoreStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTableRestoreStatusResponse
newDescribeTableRestoreStatusResponse :: Int -> DescribeTableRestoreStatusResponse
newDescribeTableRestoreStatusResponse Int
pHttpStatus_ =
  DescribeTableRestoreStatusResponse' :: Maybe Text
-> Maybe [TableRestoreStatus]
-> Int
-> DescribeTableRestoreStatusResponse
DescribeTableRestoreStatusResponse'
    { $sel:marker:DescribeTableRestoreStatusResponse' :: Maybe Text
marker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tableRestoreStatusDetails:DescribeTableRestoreStatusResponse' :: Maybe [TableRestoreStatus]
tableRestoreStatusDetails =
        Maybe [TableRestoreStatus]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeTableRestoreStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | A list of status details for one or more table restore requests.
describeTableRestoreStatusResponse_tableRestoreStatusDetails :: Lens.Lens' DescribeTableRestoreStatusResponse (Prelude.Maybe [TableRestoreStatus])
describeTableRestoreStatusResponse_tableRestoreStatusDetails :: (Maybe [TableRestoreStatus] -> f (Maybe [TableRestoreStatus]))
-> DescribeTableRestoreStatusResponse
-> f DescribeTableRestoreStatusResponse
describeTableRestoreStatusResponse_tableRestoreStatusDetails = (DescribeTableRestoreStatusResponse -> Maybe [TableRestoreStatus])
-> (DescribeTableRestoreStatusResponse
    -> Maybe [TableRestoreStatus]
    -> DescribeTableRestoreStatusResponse)
-> Lens'
     DescribeTableRestoreStatusResponse (Maybe [TableRestoreStatus])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableRestoreStatusResponse' {Maybe [TableRestoreStatus]
tableRestoreStatusDetails :: Maybe [TableRestoreStatus]
$sel:tableRestoreStatusDetails:DescribeTableRestoreStatusResponse' :: DescribeTableRestoreStatusResponse -> Maybe [TableRestoreStatus]
tableRestoreStatusDetails} -> Maybe [TableRestoreStatus]
tableRestoreStatusDetails) (\s :: DescribeTableRestoreStatusResponse
s@DescribeTableRestoreStatusResponse' {} Maybe [TableRestoreStatus]
a -> DescribeTableRestoreStatusResponse
s {$sel:tableRestoreStatusDetails:DescribeTableRestoreStatusResponse' :: Maybe [TableRestoreStatus]
tableRestoreStatusDetails = Maybe [TableRestoreStatus]
a} :: DescribeTableRestoreStatusResponse) ((Maybe [TableRestoreStatus] -> f (Maybe [TableRestoreStatus]))
 -> DescribeTableRestoreStatusResponse
 -> f DescribeTableRestoreStatusResponse)
-> ((Maybe [TableRestoreStatus] -> f (Maybe [TableRestoreStatus]))
    -> Maybe [TableRestoreStatus] -> f (Maybe [TableRestoreStatus]))
-> (Maybe [TableRestoreStatus] -> f (Maybe [TableRestoreStatus]))
-> DescribeTableRestoreStatusResponse
-> f DescribeTableRestoreStatusResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [TableRestoreStatus]
  [TableRestoreStatus]
  [TableRestoreStatus]
  [TableRestoreStatus]
-> Iso
     (Maybe [TableRestoreStatus])
     (Maybe [TableRestoreStatus])
     (Maybe [TableRestoreStatus])
     (Maybe [TableRestoreStatus])
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
  [TableRestoreStatus]
  [TableRestoreStatus]
  [TableRestoreStatus]
  [TableRestoreStatus]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeTableRestoreStatusResponse