{-# 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.DMS.DescribeTableStatistics
-- 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 table statistics on the database migration task, including table
-- name, rows inserted, rows updated, and rows deleted.
--
-- Note that the \"last updated\" column the DMS console only indicates the
-- time that DMS last updated the table statistics record for a table. It
-- does not indicate the time of the last update to the table.
--
-- This operation returns paginated results.
module Amazonka.DMS.DescribeTableStatistics
  ( -- * Creating a Request
    DescribeTableStatistics (..),
    newDescribeTableStatistics,

    -- * Request Lenses
    describeTableStatistics_filters,
    describeTableStatistics_marker,
    describeTableStatistics_maxRecords,
    describeTableStatistics_replicationTaskArn,

    -- * Destructuring the Response
    DescribeTableStatisticsResponse (..),
    newDescribeTableStatisticsResponse,

    -- * Response Lenses
    describeTableStatisticsResponse_replicationTaskArn,
    describeTableStatisticsResponse_marker,
    describeTableStatisticsResponse_tableStatistics,
    describeTableStatisticsResponse_httpStatus,
  )
where

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

-- |
--
-- /See:/ 'newDescribeTableStatistics' smart constructor.
data DescribeTableStatistics = DescribeTableStatistics'
  { -- | Filters applied to table statistics.
    --
    -- Valid filter names: schema-name | table-name | table-state
    --
    -- A combination of filters creates an AND condition where each record
    -- matches all specified filters.
    DescribeTableStatistics -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- marker, up to the value specified by @MaxRecords@.
    DescribeTableStatistics -> 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.
    --
    -- Default: 100
    --
    -- Constraints: Minimum 20, maximum 500.
    DescribeTableStatistics -> Maybe Int
maxRecords :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the replication task.
    DescribeTableStatistics -> Text
replicationTaskArn :: Prelude.Text
  }
  deriving (DescribeTableStatistics -> DescribeTableStatistics -> Bool
(DescribeTableStatistics -> DescribeTableStatistics -> Bool)
-> (DescribeTableStatistics -> DescribeTableStatistics -> Bool)
-> Eq DescribeTableStatistics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTableStatistics -> DescribeTableStatistics -> Bool
$c/= :: DescribeTableStatistics -> DescribeTableStatistics -> Bool
== :: DescribeTableStatistics -> DescribeTableStatistics -> Bool
$c== :: DescribeTableStatistics -> DescribeTableStatistics -> Bool
Prelude.Eq, ReadPrec [DescribeTableStatistics]
ReadPrec DescribeTableStatistics
Int -> ReadS DescribeTableStatistics
ReadS [DescribeTableStatistics]
(Int -> ReadS DescribeTableStatistics)
-> ReadS [DescribeTableStatistics]
-> ReadPrec DescribeTableStatistics
-> ReadPrec [DescribeTableStatistics]
-> Read DescribeTableStatistics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTableStatistics]
$creadListPrec :: ReadPrec [DescribeTableStatistics]
readPrec :: ReadPrec DescribeTableStatistics
$creadPrec :: ReadPrec DescribeTableStatistics
readList :: ReadS [DescribeTableStatistics]
$creadList :: ReadS [DescribeTableStatistics]
readsPrec :: Int -> ReadS DescribeTableStatistics
$creadsPrec :: Int -> ReadS DescribeTableStatistics
Prelude.Read, Int -> DescribeTableStatistics -> ShowS
[DescribeTableStatistics] -> ShowS
DescribeTableStatistics -> String
(Int -> DescribeTableStatistics -> ShowS)
-> (DescribeTableStatistics -> String)
-> ([DescribeTableStatistics] -> ShowS)
-> Show DescribeTableStatistics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTableStatistics] -> ShowS
$cshowList :: [DescribeTableStatistics] -> ShowS
show :: DescribeTableStatistics -> String
$cshow :: DescribeTableStatistics -> String
showsPrec :: Int -> DescribeTableStatistics -> ShowS
$cshowsPrec :: Int -> DescribeTableStatistics -> ShowS
Prelude.Show, (forall x.
 DescribeTableStatistics -> Rep DescribeTableStatistics x)
-> (forall x.
    Rep DescribeTableStatistics x -> DescribeTableStatistics)
-> Generic DescribeTableStatistics
forall x. Rep DescribeTableStatistics x -> DescribeTableStatistics
forall x. DescribeTableStatistics -> Rep DescribeTableStatistics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTableStatistics x -> DescribeTableStatistics
$cfrom :: forall x. DescribeTableStatistics -> Rep DescribeTableStatistics x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTableStatistics' 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:
--
-- 'filters', 'describeTableStatistics_filters' - Filters applied to table statistics.
--
-- Valid filter names: schema-name | table-name | table-state
--
-- A combination of filters creates an AND condition where each record
-- matches all specified filters.
--
-- 'marker', 'describeTableStatistics_marker' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
--
-- 'maxRecords', 'describeTableStatistics_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.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 500.
--
-- 'replicationTaskArn', 'describeTableStatistics_replicationTaskArn' - The Amazon Resource Name (ARN) of the replication task.
newDescribeTableStatistics ::
  -- | 'replicationTaskArn'
  Prelude.Text ->
  DescribeTableStatistics
newDescribeTableStatistics :: Text -> DescribeTableStatistics
newDescribeTableStatistics Text
pReplicationTaskArn_ =
  DescribeTableStatistics' :: Maybe [Filter]
-> Maybe Text -> Maybe Int -> Text -> DescribeTableStatistics
DescribeTableStatistics'
    { $sel:filters:DescribeTableStatistics' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeTableStatistics' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxRecords:DescribeTableStatistics' :: Maybe Int
maxRecords = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:replicationTaskArn:DescribeTableStatistics' :: Text
replicationTaskArn = Text
pReplicationTaskArn_
    }

-- | Filters applied to table statistics.
--
-- Valid filter names: schema-name | table-name | table-state
--
-- A combination of filters creates an AND condition where each record
-- matches all specified filters.
describeTableStatistics_filters :: Lens.Lens' DescribeTableStatistics (Prelude.Maybe [Filter])
describeTableStatistics_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeTableStatistics -> f DescribeTableStatistics
describeTableStatistics_filters = (DescribeTableStatistics -> Maybe [Filter])
-> (DescribeTableStatistics
    -> Maybe [Filter] -> DescribeTableStatistics)
-> Lens
     DescribeTableStatistics
     DescribeTableStatistics
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableStatistics' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:DescribeTableStatistics' :: DescribeTableStatistics -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: DescribeTableStatistics
s@DescribeTableStatistics' {} Maybe [Filter]
a -> DescribeTableStatistics
s {$sel:filters:DescribeTableStatistics' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: DescribeTableStatistics) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> DescribeTableStatistics -> f DescribeTableStatistics)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> DescribeTableStatistics
-> f DescribeTableStatistics
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | 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.
--
-- Default: 100
--
-- Constraints: Minimum 20, maximum 500.
describeTableStatistics_maxRecords :: Lens.Lens' DescribeTableStatistics (Prelude.Maybe Prelude.Int)
describeTableStatistics_maxRecords :: (Maybe Int -> f (Maybe Int))
-> DescribeTableStatistics -> f DescribeTableStatistics
describeTableStatistics_maxRecords = (DescribeTableStatistics -> Maybe Int)
-> (DescribeTableStatistics
    -> Maybe Int -> DescribeTableStatistics)
-> Lens
     DescribeTableStatistics
     DescribeTableStatistics
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableStatistics' {Maybe Int
maxRecords :: Maybe Int
$sel:maxRecords:DescribeTableStatistics' :: DescribeTableStatistics -> Maybe Int
maxRecords} -> Maybe Int
maxRecords) (\s :: DescribeTableStatistics
s@DescribeTableStatistics' {} Maybe Int
a -> DescribeTableStatistics
s {$sel:maxRecords:DescribeTableStatistics' :: Maybe Int
maxRecords = Maybe Int
a} :: DescribeTableStatistics)

-- | The Amazon Resource Name (ARN) of the replication task.
describeTableStatistics_replicationTaskArn :: Lens.Lens' DescribeTableStatistics Prelude.Text
describeTableStatistics_replicationTaskArn :: (Text -> f Text)
-> DescribeTableStatistics -> f DescribeTableStatistics
describeTableStatistics_replicationTaskArn = (DescribeTableStatistics -> Text)
-> (DescribeTableStatistics -> Text -> DescribeTableStatistics)
-> Lens DescribeTableStatistics DescribeTableStatistics Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableStatistics' {Text
replicationTaskArn :: Text
$sel:replicationTaskArn:DescribeTableStatistics' :: DescribeTableStatistics -> Text
replicationTaskArn} -> Text
replicationTaskArn) (\s :: DescribeTableStatistics
s@DescribeTableStatistics' {} Text
a -> DescribeTableStatistics
s {$sel:replicationTaskArn:DescribeTableStatistics' :: Text
replicationTaskArn = Text
a} :: DescribeTableStatistics)

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

instance Prelude.NFData DescribeTableStatistics

instance Core.ToHeaders DescribeTableStatistics where
  toHeaders :: DescribeTableStatistics -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeTableStatistics -> 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
"AmazonDMSv20160101.DescribeTableStatistics" ::
                          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 DescribeTableStatistics where
  toJSON :: DescribeTableStatistics -> Value
toJSON DescribeTableStatistics' {Maybe Int
Maybe [Filter]
Maybe Text
Text
replicationTaskArn :: Text
maxRecords :: Maybe Int
marker :: Maybe Text
filters :: Maybe [Filter]
$sel:replicationTaskArn:DescribeTableStatistics' :: DescribeTableStatistics -> Text
$sel:maxRecords:DescribeTableStatistics' :: DescribeTableStatistics -> Maybe Int
$sel:marker:DescribeTableStatistics' :: DescribeTableStatistics -> Maybe Text
$sel:filters:DescribeTableStatistics' :: DescribeTableStatistics -> Maybe [Filter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (Text
"Marker" 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
marker,
            (Text
"MaxRecords" 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
maxRecords,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ReplicationTaskArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
replicationTaskArn)
          ]
      )

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

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

-- |
--
-- /See:/ 'newDescribeTableStatisticsResponse' smart constructor.
data DescribeTableStatisticsResponse = DescribeTableStatisticsResponse'
  { -- | The Amazon Resource Name (ARN) of the replication task.
    DescribeTableStatisticsResponse -> Maybe Text
replicationTaskArn :: Prelude.Maybe Prelude.Text,
    -- | An optional pagination token provided by a previous request. If this
    -- parameter is specified, the response includes only records beyond the
    -- marker, up to the value specified by @MaxRecords@.
    DescribeTableStatisticsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The table statistics.
    DescribeTableStatisticsResponse -> Maybe [TableStatistics]
tableStatistics :: Prelude.Maybe [TableStatistics],
    -- | The response's http status code.
    DescribeTableStatisticsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeTableStatisticsResponse
-> DescribeTableStatisticsResponse -> Bool
(DescribeTableStatisticsResponse
 -> DescribeTableStatisticsResponse -> Bool)
-> (DescribeTableStatisticsResponse
    -> DescribeTableStatisticsResponse -> Bool)
-> Eq DescribeTableStatisticsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTableStatisticsResponse
-> DescribeTableStatisticsResponse -> Bool
$c/= :: DescribeTableStatisticsResponse
-> DescribeTableStatisticsResponse -> Bool
== :: DescribeTableStatisticsResponse
-> DescribeTableStatisticsResponse -> Bool
$c== :: DescribeTableStatisticsResponse
-> DescribeTableStatisticsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTableStatisticsResponse]
ReadPrec DescribeTableStatisticsResponse
Int -> ReadS DescribeTableStatisticsResponse
ReadS [DescribeTableStatisticsResponse]
(Int -> ReadS DescribeTableStatisticsResponse)
-> ReadS [DescribeTableStatisticsResponse]
-> ReadPrec DescribeTableStatisticsResponse
-> ReadPrec [DescribeTableStatisticsResponse]
-> Read DescribeTableStatisticsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTableStatisticsResponse]
$creadListPrec :: ReadPrec [DescribeTableStatisticsResponse]
readPrec :: ReadPrec DescribeTableStatisticsResponse
$creadPrec :: ReadPrec DescribeTableStatisticsResponse
readList :: ReadS [DescribeTableStatisticsResponse]
$creadList :: ReadS [DescribeTableStatisticsResponse]
readsPrec :: Int -> ReadS DescribeTableStatisticsResponse
$creadsPrec :: Int -> ReadS DescribeTableStatisticsResponse
Prelude.Read, Int -> DescribeTableStatisticsResponse -> ShowS
[DescribeTableStatisticsResponse] -> ShowS
DescribeTableStatisticsResponse -> String
(Int -> DescribeTableStatisticsResponse -> ShowS)
-> (DescribeTableStatisticsResponse -> String)
-> ([DescribeTableStatisticsResponse] -> ShowS)
-> Show DescribeTableStatisticsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTableStatisticsResponse] -> ShowS
$cshowList :: [DescribeTableStatisticsResponse] -> ShowS
show :: DescribeTableStatisticsResponse -> String
$cshow :: DescribeTableStatisticsResponse -> String
showsPrec :: Int -> DescribeTableStatisticsResponse -> ShowS
$cshowsPrec :: Int -> DescribeTableStatisticsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeTableStatisticsResponse
 -> Rep DescribeTableStatisticsResponse x)
-> (forall x.
    Rep DescribeTableStatisticsResponse x
    -> DescribeTableStatisticsResponse)
-> Generic DescribeTableStatisticsResponse
forall x.
Rep DescribeTableStatisticsResponse x
-> DescribeTableStatisticsResponse
forall x.
DescribeTableStatisticsResponse
-> Rep DescribeTableStatisticsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeTableStatisticsResponse x
-> DescribeTableStatisticsResponse
$cfrom :: forall x.
DescribeTableStatisticsResponse
-> Rep DescribeTableStatisticsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTableStatisticsResponse' 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:
--
-- 'replicationTaskArn', 'describeTableStatisticsResponse_replicationTaskArn' - The Amazon Resource Name (ARN) of the replication task.
--
-- 'marker', 'describeTableStatisticsResponse_marker' - An optional pagination token provided by a previous request. If this
-- parameter is specified, the response includes only records beyond the
-- marker, up to the value specified by @MaxRecords@.
--
-- 'tableStatistics', 'describeTableStatisticsResponse_tableStatistics' - The table statistics.
--
-- 'httpStatus', 'describeTableStatisticsResponse_httpStatus' - The response's http status code.
newDescribeTableStatisticsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTableStatisticsResponse
newDescribeTableStatisticsResponse :: Int -> DescribeTableStatisticsResponse
newDescribeTableStatisticsResponse Int
pHttpStatus_ =
  DescribeTableStatisticsResponse' :: Maybe Text
-> Maybe Text
-> Maybe [TableStatistics]
-> Int
-> DescribeTableStatisticsResponse
DescribeTableStatisticsResponse'
    { $sel:replicationTaskArn:DescribeTableStatisticsResponse' :: Maybe Text
replicationTaskArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeTableStatisticsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tableStatistics:DescribeTableStatisticsResponse' :: Maybe [TableStatistics]
tableStatistics = Maybe [TableStatistics]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeTableStatisticsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the replication task.
describeTableStatisticsResponse_replicationTaskArn :: Lens.Lens' DescribeTableStatisticsResponse (Prelude.Maybe Prelude.Text)
describeTableStatisticsResponse_replicationTaskArn :: (Maybe Text -> f (Maybe Text))
-> DescribeTableStatisticsResponse
-> f DescribeTableStatisticsResponse
describeTableStatisticsResponse_replicationTaskArn = (DescribeTableStatisticsResponse -> Maybe Text)
-> (DescribeTableStatisticsResponse
    -> Maybe Text -> DescribeTableStatisticsResponse)
-> Lens' DescribeTableStatisticsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableStatisticsResponse' {Maybe Text
replicationTaskArn :: Maybe Text
$sel:replicationTaskArn:DescribeTableStatisticsResponse' :: DescribeTableStatisticsResponse -> Maybe Text
replicationTaskArn} -> Maybe Text
replicationTaskArn) (\s :: DescribeTableStatisticsResponse
s@DescribeTableStatisticsResponse' {} Maybe Text
a -> DescribeTableStatisticsResponse
s {$sel:replicationTaskArn:DescribeTableStatisticsResponse' :: Maybe Text
replicationTaskArn = Maybe Text
a} :: DescribeTableStatisticsResponse)

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

-- | The table statistics.
describeTableStatisticsResponse_tableStatistics :: Lens.Lens' DescribeTableStatisticsResponse (Prelude.Maybe [TableStatistics])
describeTableStatisticsResponse_tableStatistics :: (Maybe [TableStatistics] -> f (Maybe [TableStatistics]))
-> DescribeTableStatisticsResponse
-> f DescribeTableStatisticsResponse
describeTableStatisticsResponse_tableStatistics = (DescribeTableStatisticsResponse -> Maybe [TableStatistics])
-> (DescribeTableStatisticsResponse
    -> Maybe [TableStatistics] -> DescribeTableStatisticsResponse)
-> Lens' DescribeTableStatisticsResponse (Maybe [TableStatistics])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTableStatisticsResponse' {Maybe [TableStatistics]
tableStatistics :: Maybe [TableStatistics]
$sel:tableStatistics:DescribeTableStatisticsResponse' :: DescribeTableStatisticsResponse -> Maybe [TableStatistics]
tableStatistics} -> Maybe [TableStatistics]
tableStatistics) (\s :: DescribeTableStatisticsResponse
s@DescribeTableStatisticsResponse' {} Maybe [TableStatistics]
a -> DescribeTableStatisticsResponse
s {$sel:tableStatistics:DescribeTableStatisticsResponse' :: Maybe [TableStatistics]
tableStatistics = Maybe [TableStatistics]
a} :: DescribeTableStatisticsResponse) ((Maybe [TableStatistics] -> f (Maybe [TableStatistics]))
 -> DescribeTableStatisticsResponse
 -> f DescribeTableStatisticsResponse)
-> ((Maybe [TableStatistics] -> f (Maybe [TableStatistics]))
    -> Maybe [TableStatistics] -> f (Maybe [TableStatistics]))
-> (Maybe [TableStatistics] -> f (Maybe [TableStatistics]))
-> DescribeTableStatisticsResponse
-> f DescribeTableStatisticsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [TableStatistics]
  [TableStatistics]
  [TableStatistics]
  [TableStatistics]
-> Iso
     (Maybe [TableStatistics])
     (Maybe [TableStatistics])
     (Maybe [TableStatistics])
     (Maybe [TableStatistics])
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
  [TableStatistics]
  [TableStatistics]
  [TableStatistics]
  [TableStatistics]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeTableStatisticsResponse