{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.KeySpaces.Types.TableSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KeySpaces.Types.TableSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Returns the name of the specified table, the keyspace it is stored in,
-- and the unique identifier in the format of an Amazon Resource Name
-- (ARN).
--
-- /See:/ 'newTableSummary' smart constructor.
data TableSummary = TableSummary'
  { -- | The name of the keyspace that the table is stored in.
    TableSummary -> Text
keyspaceName :: Prelude.Text,
    -- | The name of the table.
    TableSummary -> Text
tableName :: Prelude.Text,
    -- | The unique identifier of the table in the format of an Amazon Resource
    -- Name (ARN).
    TableSummary -> Text
resourceArn :: Prelude.Text
  }
  deriving (TableSummary -> TableSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableSummary -> TableSummary -> Bool
$c/= :: TableSummary -> TableSummary -> Bool
== :: TableSummary -> TableSummary -> Bool
$c== :: TableSummary -> TableSummary -> Bool
Prelude.Eq, ReadPrec [TableSummary]
ReadPrec TableSummary
Int -> ReadS TableSummary
ReadS [TableSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TableSummary]
$creadListPrec :: ReadPrec [TableSummary]
readPrec :: ReadPrec TableSummary
$creadPrec :: ReadPrec TableSummary
readList :: ReadS [TableSummary]
$creadList :: ReadS [TableSummary]
readsPrec :: Int -> ReadS TableSummary
$creadsPrec :: Int -> ReadS TableSummary
Prelude.Read, Int -> TableSummary -> ShowS
[TableSummary] -> ShowS
TableSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableSummary] -> ShowS
$cshowList :: [TableSummary] -> ShowS
show :: TableSummary -> String
$cshow :: TableSummary -> String
showsPrec :: Int -> TableSummary -> ShowS
$cshowsPrec :: Int -> TableSummary -> ShowS
Prelude.Show, forall x. Rep TableSummary x -> TableSummary
forall x. TableSummary -> Rep TableSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableSummary x -> TableSummary
$cfrom :: forall x. TableSummary -> Rep TableSummary x
Prelude.Generic)

-- |
-- Create a value of 'TableSummary' 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:
--
-- 'keyspaceName', 'tableSummary_keyspaceName' - The name of the keyspace that the table is stored in.
--
-- 'tableName', 'tableSummary_tableName' - The name of the table.
--
-- 'resourceArn', 'tableSummary_resourceArn' - The unique identifier of the table in the format of an Amazon Resource
-- Name (ARN).
newTableSummary ::
  -- | 'keyspaceName'
  Prelude.Text ->
  -- | 'tableName'
  Prelude.Text ->
  -- | 'resourceArn'
  Prelude.Text ->
  TableSummary
newTableSummary :: Text -> Text -> Text -> TableSummary
newTableSummary
  Text
pKeyspaceName_
  Text
pTableName_
  Text
pResourceArn_ =
    TableSummary'
      { $sel:keyspaceName:TableSummary' :: Text
keyspaceName = Text
pKeyspaceName_,
        $sel:tableName:TableSummary' :: Text
tableName = Text
pTableName_,
        $sel:resourceArn:TableSummary' :: Text
resourceArn = Text
pResourceArn_
      }

-- | The name of the keyspace that the table is stored in.
tableSummary_keyspaceName :: Lens.Lens' TableSummary Prelude.Text
tableSummary_keyspaceName :: Lens' TableSummary Text
tableSummary_keyspaceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableSummary' {Text
keyspaceName :: Text
$sel:keyspaceName:TableSummary' :: TableSummary -> Text
keyspaceName} -> Text
keyspaceName) (\s :: TableSummary
s@TableSummary' {} Text
a -> TableSummary
s {$sel:keyspaceName:TableSummary' :: Text
keyspaceName = Text
a} :: TableSummary)

-- | The name of the table.
tableSummary_tableName :: Lens.Lens' TableSummary Prelude.Text
tableSummary_tableName :: Lens' TableSummary Text
tableSummary_tableName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableSummary' {Text
tableName :: Text
$sel:tableName:TableSummary' :: TableSummary -> Text
tableName} -> Text
tableName) (\s :: TableSummary
s@TableSummary' {} Text
a -> TableSummary
s {$sel:tableName:TableSummary' :: Text
tableName = Text
a} :: TableSummary)

-- | The unique identifier of the table in the format of an Amazon Resource
-- Name (ARN).
tableSummary_resourceArn :: Lens.Lens' TableSummary Prelude.Text
tableSummary_resourceArn :: Lens' TableSummary Text
tableSummary_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TableSummary' {Text
resourceArn :: Text
$sel:resourceArn:TableSummary' :: TableSummary -> Text
resourceArn} -> Text
resourceArn) (\s :: TableSummary
s@TableSummary' {} Text
a -> TableSummary
s {$sel:resourceArn:TableSummary' :: Text
resourceArn = Text
a} :: TableSummary)

instance Data.FromJSON TableSummary where
  parseJSON :: Value -> Parser TableSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TableSummary"
      ( \Object
x ->
          Text -> Text -> Text -> TableSummary
TableSummary'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"keyspaceName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"tableName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"resourceArn")
      )

instance Prelude.Hashable TableSummary where
  hashWithSalt :: Int -> TableSummary -> Int
hashWithSalt Int
_salt TableSummary' {Text
resourceArn :: Text
tableName :: Text
keyspaceName :: Text
$sel:resourceArn:TableSummary' :: TableSummary -> Text
$sel:tableName:TableSummary' :: TableSummary -> Text
$sel:keyspaceName:TableSummary' :: TableSummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
keyspaceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
tableName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceArn

instance Prelude.NFData TableSummary where
  rnf :: TableSummary -> ()
rnf TableSummary' {Text
resourceArn :: Text
tableName :: Text
keyspaceName :: Text
$sel:resourceArn:TableSummary' :: TableSummary -> Text
$sel:tableName:TableSummary' :: TableSummary -> Text
$sel:keyspaceName:TableSummary' :: TableSummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
keyspaceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
tableName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceArn