{-# 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.DynamoDB.Types.GlobalSecondaryIndexDescription
-- 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)
module Amazonka.DynamoDB.Types.GlobalSecondaryIndexDescription where

import qualified Amazonka.Core as Core
import Amazonka.DynamoDB.Types.IndexStatus
import Amazonka.DynamoDB.Types.KeySchemaElement
import Amazonka.DynamoDB.Types.Projection
import Amazonka.DynamoDB.Types.ProvisionedThroughputDescription
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents the properties of a global secondary index.
--
-- /See:/ 'newGlobalSecondaryIndexDescription' smart constructor.
data GlobalSecondaryIndexDescription = GlobalSecondaryIndexDescription'
  { -- | Indicates whether the index is currently backfilling. /Backfilling/ is
    -- the process of reading items from the table and determining whether they
    -- can be added to the index. (Not all items will qualify: For example, a
    -- partition key cannot have any duplicate values.) If an item can be added
    -- to the index, DynamoDB will do so. After all items have been processed,
    -- the backfilling operation is complete and @Backfilling@ is false.
    --
    -- You can delete an index that is being created during the @Backfilling@
    -- phase when @IndexStatus@ is set to CREATING and @Backfilling@ is true.
    -- You can\'t delete the index that is being created when @IndexStatus@ is
    -- set to CREATING and @Backfilling@ is false.
    --
    -- For indexes that were created during a @CreateTable@ operation, the
    -- @Backfilling@ attribute does not appear in the @DescribeTable@ output.
    GlobalSecondaryIndexDescription -> Maybe Bool
backfilling :: Prelude.Maybe Prelude.Bool,
    -- | The total size of the specified index, in bytes. DynamoDB updates this
    -- value approximately every six hours. Recent changes might not be
    -- reflected in this value.
    GlobalSecondaryIndexDescription -> Maybe Integer
indexSizeBytes :: Prelude.Maybe Prelude.Integer,
    -- | The current state of the global secondary index:
    --
    -- -   @CREATING@ - The index is being created.
    --
    -- -   @UPDATING@ - The index is being updated.
    --
    -- -   @DELETING@ - The index is being deleted.
    --
    -- -   @ACTIVE@ - The index is ready for use.
    GlobalSecondaryIndexDescription -> Maybe IndexStatus
indexStatus :: Prelude.Maybe IndexStatus,
    -- | Represents the provisioned throughput settings for the specified global
    -- secondary index.
    --
    -- For current minimum and maximum provisioned throughput values, see
    -- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html Service, Account, and Table Quotas>
    -- in the /Amazon DynamoDB Developer Guide/.
    GlobalSecondaryIndexDescription
-> Maybe ProvisionedThroughputDescription
provisionedThroughput :: Prelude.Maybe ProvisionedThroughputDescription,
    -- | The Amazon Resource Name (ARN) that uniquely identifies the index.
    GlobalSecondaryIndexDescription -> Maybe Text
indexArn :: Prelude.Maybe Prelude.Text,
    -- | The complete key schema for a global secondary index, which consists of
    -- one or more pairs of attribute names and key types:
    --
    -- -   @HASH@ - partition key
    --
    -- -   @RANGE@ - sort key
    --
    -- The partition key of an item is also known as its /hash attribute/. The
    -- term \"hash attribute\" derives from DynamoDB\'s usage of an internal
    -- hash function to evenly distribute data items across partitions, based
    -- on their partition key values.
    --
    -- The sort key of an item is also known as its /range attribute/. The term
    -- \"range attribute\" derives from the way DynamoDB stores items with the
    -- same partition key physically close together, in sorted order by the
    -- sort key value.
    GlobalSecondaryIndexDescription
-> Maybe (NonEmpty KeySchemaElement)
keySchema :: Prelude.Maybe (Prelude.NonEmpty KeySchemaElement),
    -- | Represents attributes that are copied (projected) from the table into
    -- the global secondary index. These are in addition to the primary key
    -- attributes and index key attributes, which are automatically projected.
    GlobalSecondaryIndexDescription -> Maybe Projection
projection :: Prelude.Maybe Projection,
    -- | The number of items in the specified index. DynamoDB updates this value
    -- approximately every six hours. Recent changes might not be reflected in
    -- this value.
    GlobalSecondaryIndexDescription -> Maybe Integer
itemCount :: Prelude.Maybe Prelude.Integer,
    -- | The name of the global secondary index.
    GlobalSecondaryIndexDescription -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text
  }
  deriving (GlobalSecondaryIndexDescription
-> GlobalSecondaryIndexDescription -> Bool
(GlobalSecondaryIndexDescription
 -> GlobalSecondaryIndexDescription -> Bool)
-> (GlobalSecondaryIndexDescription
    -> GlobalSecondaryIndexDescription -> Bool)
-> Eq GlobalSecondaryIndexDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GlobalSecondaryIndexDescription
-> GlobalSecondaryIndexDescription -> Bool
$c/= :: GlobalSecondaryIndexDescription
-> GlobalSecondaryIndexDescription -> Bool
== :: GlobalSecondaryIndexDescription
-> GlobalSecondaryIndexDescription -> Bool
$c== :: GlobalSecondaryIndexDescription
-> GlobalSecondaryIndexDescription -> Bool
Prelude.Eq, ReadPrec [GlobalSecondaryIndexDescription]
ReadPrec GlobalSecondaryIndexDescription
Int -> ReadS GlobalSecondaryIndexDescription
ReadS [GlobalSecondaryIndexDescription]
(Int -> ReadS GlobalSecondaryIndexDescription)
-> ReadS [GlobalSecondaryIndexDescription]
-> ReadPrec GlobalSecondaryIndexDescription
-> ReadPrec [GlobalSecondaryIndexDescription]
-> Read GlobalSecondaryIndexDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GlobalSecondaryIndexDescription]
$creadListPrec :: ReadPrec [GlobalSecondaryIndexDescription]
readPrec :: ReadPrec GlobalSecondaryIndexDescription
$creadPrec :: ReadPrec GlobalSecondaryIndexDescription
readList :: ReadS [GlobalSecondaryIndexDescription]
$creadList :: ReadS [GlobalSecondaryIndexDescription]
readsPrec :: Int -> ReadS GlobalSecondaryIndexDescription
$creadsPrec :: Int -> ReadS GlobalSecondaryIndexDescription
Prelude.Read, Int -> GlobalSecondaryIndexDescription -> ShowS
[GlobalSecondaryIndexDescription] -> ShowS
GlobalSecondaryIndexDescription -> String
(Int -> GlobalSecondaryIndexDescription -> ShowS)
-> (GlobalSecondaryIndexDescription -> String)
-> ([GlobalSecondaryIndexDescription] -> ShowS)
-> Show GlobalSecondaryIndexDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GlobalSecondaryIndexDescription] -> ShowS
$cshowList :: [GlobalSecondaryIndexDescription] -> ShowS
show :: GlobalSecondaryIndexDescription -> String
$cshow :: GlobalSecondaryIndexDescription -> String
showsPrec :: Int -> GlobalSecondaryIndexDescription -> ShowS
$cshowsPrec :: Int -> GlobalSecondaryIndexDescription -> ShowS
Prelude.Show, (forall x.
 GlobalSecondaryIndexDescription
 -> Rep GlobalSecondaryIndexDescription x)
-> (forall x.
    Rep GlobalSecondaryIndexDescription x
    -> GlobalSecondaryIndexDescription)
-> Generic GlobalSecondaryIndexDescription
forall x.
Rep GlobalSecondaryIndexDescription x
-> GlobalSecondaryIndexDescription
forall x.
GlobalSecondaryIndexDescription
-> Rep GlobalSecondaryIndexDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GlobalSecondaryIndexDescription x
-> GlobalSecondaryIndexDescription
$cfrom :: forall x.
GlobalSecondaryIndexDescription
-> Rep GlobalSecondaryIndexDescription x
Prelude.Generic)

-- |
-- Create a value of 'GlobalSecondaryIndexDescription' 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:
--
-- 'backfilling', 'globalSecondaryIndexDescription_backfilling' - Indicates whether the index is currently backfilling. /Backfilling/ is
-- the process of reading items from the table and determining whether they
-- can be added to the index. (Not all items will qualify: For example, a
-- partition key cannot have any duplicate values.) If an item can be added
-- to the index, DynamoDB will do so. After all items have been processed,
-- the backfilling operation is complete and @Backfilling@ is false.
--
-- You can delete an index that is being created during the @Backfilling@
-- phase when @IndexStatus@ is set to CREATING and @Backfilling@ is true.
-- You can\'t delete the index that is being created when @IndexStatus@ is
-- set to CREATING and @Backfilling@ is false.
--
-- For indexes that were created during a @CreateTable@ operation, the
-- @Backfilling@ attribute does not appear in the @DescribeTable@ output.
--
-- 'indexSizeBytes', 'globalSecondaryIndexDescription_indexSizeBytes' - The total size of the specified index, in bytes. DynamoDB updates this
-- value approximately every six hours. Recent changes might not be
-- reflected in this value.
--
-- 'indexStatus', 'globalSecondaryIndexDescription_indexStatus' - The current state of the global secondary index:
--
-- -   @CREATING@ - The index is being created.
--
-- -   @UPDATING@ - The index is being updated.
--
-- -   @DELETING@ - The index is being deleted.
--
-- -   @ACTIVE@ - The index is ready for use.
--
-- 'provisionedThroughput', 'globalSecondaryIndexDescription_provisionedThroughput' - Represents the provisioned throughput settings for the specified global
-- secondary index.
--
-- For current minimum and maximum provisioned throughput values, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html Service, Account, and Table Quotas>
-- in the /Amazon DynamoDB Developer Guide/.
--
-- 'indexArn', 'globalSecondaryIndexDescription_indexArn' - The Amazon Resource Name (ARN) that uniquely identifies the index.
--
-- 'keySchema', 'globalSecondaryIndexDescription_keySchema' - The complete key schema for a global secondary index, which consists of
-- one or more pairs of attribute names and key types:
--
-- -   @HASH@ - partition key
--
-- -   @RANGE@ - sort key
--
-- The partition key of an item is also known as its /hash attribute/. The
-- term \"hash attribute\" derives from DynamoDB\'s usage of an internal
-- hash function to evenly distribute data items across partitions, based
-- on their partition key values.
--
-- The sort key of an item is also known as its /range attribute/. The term
-- \"range attribute\" derives from the way DynamoDB stores items with the
-- same partition key physically close together, in sorted order by the
-- sort key value.
--
-- 'projection', 'globalSecondaryIndexDescription_projection' - Represents attributes that are copied (projected) from the table into
-- the global secondary index. These are in addition to the primary key
-- attributes and index key attributes, which are automatically projected.
--
-- 'itemCount', 'globalSecondaryIndexDescription_itemCount' - The number of items in the specified index. DynamoDB updates this value
-- approximately every six hours. Recent changes might not be reflected in
-- this value.
--
-- 'indexName', 'globalSecondaryIndexDescription_indexName' - The name of the global secondary index.
newGlobalSecondaryIndexDescription ::
  GlobalSecondaryIndexDescription
newGlobalSecondaryIndexDescription :: GlobalSecondaryIndexDescription
newGlobalSecondaryIndexDescription =
  GlobalSecondaryIndexDescription' :: Maybe Bool
-> Maybe Integer
-> Maybe IndexStatus
-> Maybe ProvisionedThroughputDescription
-> Maybe Text
-> Maybe (NonEmpty KeySchemaElement)
-> Maybe Projection
-> Maybe Integer
-> Maybe Text
-> GlobalSecondaryIndexDescription
GlobalSecondaryIndexDescription'
    { $sel:backfilling:GlobalSecondaryIndexDescription' :: Maybe Bool
backfilling =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:indexSizeBytes:GlobalSecondaryIndexDescription' :: Maybe Integer
indexSizeBytes = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:indexStatus:GlobalSecondaryIndexDescription' :: Maybe IndexStatus
indexStatus = Maybe IndexStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:provisionedThroughput:GlobalSecondaryIndexDescription' :: Maybe ProvisionedThroughputDescription
provisionedThroughput = Maybe ProvisionedThroughputDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:indexArn:GlobalSecondaryIndexDescription' :: Maybe Text
indexArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:keySchema:GlobalSecondaryIndexDescription' :: Maybe (NonEmpty KeySchemaElement)
keySchema = Maybe (NonEmpty KeySchemaElement)
forall a. Maybe a
Prelude.Nothing,
      $sel:projection:GlobalSecondaryIndexDescription' :: Maybe Projection
projection = Maybe Projection
forall a. Maybe a
Prelude.Nothing,
      $sel:itemCount:GlobalSecondaryIndexDescription' :: Maybe Integer
itemCount = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:GlobalSecondaryIndexDescription' :: Maybe Text
indexName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether the index is currently backfilling. /Backfilling/ is
-- the process of reading items from the table and determining whether they
-- can be added to the index. (Not all items will qualify: For example, a
-- partition key cannot have any duplicate values.) If an item can be added
-- to the index, DynamoDB will do so. After all items have been processed,
-- the backfilling operation is complete and @Backfilling@ is false.
--
-- You can delete an index that is being created during the @Backfilling@
-- phase when @IndexStatus@ is set to CREATING and @Backfilling@ is true.
-- You can\'t delete the index that is being created when @IndexStatus@ is
-- set to CREATING and @Backfilling@ is false.
--
-- For indexes that were created during a @CreateTable@ operation, the
-- @Backfilling@ attribute does not appear in the @DescribeTable@ output.
globalSecondaryIndexDescription_backfilling :: Lens.Lens' GlobalSecondaryIndexDescription (Prelude.Maybe Prelude.Bool)
globalSecondaryIndexDescription_backfilling :: (Maybe Bool -> f (Maybe Bool))
-> GlobalSecondaryIndexDescription
-> f GlobalSecondaryIndexDescription
globalSecondaryIndexDescription_backfilling = (GlobalSecondaryIndexDescription -> Maybe Bool)
-> (GlobalSecondaryIndexDescription
    -> Maybe Bool -> GlobalSecondaryIndexDescription)
-> Lens
     GlobalSecondaryIndexDescription
     GlobalSecondaryIndexDescription
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalSecondaryIndexDescription' {Maybe Bool
backfilling :: Maybe Bool
$sel:backfilling:GlobalSecondaryIndexDescription' :: GlobalSecondaryIndexDescription -> Maybe Bool
backfilling} -> Maybe Bool
backfilling) (\s :: GlobalSecondaryIndexDescription
s@GlobalSecondaryIndexDescription' {} Maybe Bool
a -> GlobalSecondaryIndexDescription
s {$sel:backfilling:GlobalSecondaryIndexDescription' :: Maybe Bool
backfilling = Maybe Bool
a} :: GlobalSecondaryIndexDescription)

-- | The total size of the specified index, in bytes. DynamoDB updates this
-- value approximately every six hours. Recent changes might not be
-- reflected in this value.
globalSecondaryIndexDescription_indexSizeBytes :: Lens.Lens' GlobalSecondaryIndexDescription (Prelude.Maybe Prelude.Integer)
globalSecondaryIndexDescription_indexSizeBytes :: (Maybe Integer -> f (Maybe Integer))
-> GlobalSecondaryIndexDescription
-> f GlobalSecondaryIndexDescription
globalSecondaryIndexDescription_indexSizeBytes = (GlobalSecondaryIndexDescription -> Maybe Integer)
-> (GlobalSecondaryIndexDescription
    -> Maybe Integer -> GlobalSecondaryIndexDescription)
-> Lens
     GlobalSecondaryIndexDescription
     GlobalSecondaryIndexDescription
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalSecondaryIndexDescription' {Maybe Integer
indexSizeBytes :: Maybe Integer
$sel:indexSizeBytes:GlobalSecondaryIndexDescription' :: GlobalSecondaryIndexDescription -> Maybe Integer
indexSizeBytes} -> Maybe Integer
indexSizeBytes) (\s :: GlobalSecondaryIndexDescription
s@GlobalSecondaryIndexDescription' {} Maybe Integer
a -> GlobalSecondaryIndexDescription
s {$sel:indexSizeBytes:GlobalSecondaryIndexDescription' :: Maybe Integer
indexSizeBytes = Maybe Integer
a} :: GlobalSecondaryIndexDescription)

-- | The current state of the global secondary index:
--
-- -   @CREATING@ - The index is being created.
--
-- -   @UPDATING@ - The index is being updated.
--
-- -   @DELETING@ - The index is being deleted.
--
-- -   @ACTIVE@ - The index is ready for use.
globalSecondaryIndexDescription_indexStatus :: Lens.Lens' GlobalSecondaryIndexDescription (Prelude.Maybe IndexStatus)
globalSecondaryIndexDescription_indexStatus :: (Maybe IndexStatus -> f (Maybe IndexStatus))
-> GlobalSecondaryIndexDescription
-> f GlobalSecondaryIndexDescription
globalSecondaryIndexDescription_indexStatus = (GlobalSecondaryIndexDescription -> Maybe IndexStatus)
-> (GlobalSecondaryIndexDescription
    -> Maybe IndexStatus -> GlobalSecondaryIndexDescription)
-> Lens
     GlobalSecondaryIndexDescription
     GlobalSecondaryIndexDescription
     (Maybe IndexStatus)
     (Maybe IndexStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalSecondaryIndexDescription' {Maybe IndexStatus
indexStatus :: Maybe IndexStatus
$sel:indexStatus:GlobalSecondaryIndexDescription' :: GlobalSecondaryIndexDescription -> Maybe IndexStatus
indexStatus} -> Maybe IndexStatus
indexStatus) (\s :: GlobalSecondaryIndexDescription
s@GlobalSecondaryIndexDescription' {} Maybe IndexStatus
a -> GlobalSecondaryIndexDescription
s {$sel:indexStatus:GlobalSecondaryIndexDescription' :: Maybe IndexStatus
indexStatus = Maybe IndexStatus
a} :: GlobalSecondaryIndexDescription)

-- | Represents the provisioned throughput settings for the specified global
-- secondary index.
--
-- For current minimum and maximum provisioned throughput values, see
-- <https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html Service, Account, and Table Quotas>
-- in the /Amazon DynamoDB Developer Guide/.
globalSecondaryIndexDescription_provisionedThroughput :: Lens.Lens' GlobalSecondaryIndexDescription (Prelude.Maybe ProvisionedThroughputDescription)
globalSecondaryIndexDescription_provisionedThroughput :: (Maybe ProvisionedThroughputDescription
 -> f (Maybe ProvisionedThroughputDescription))
-> GlobalSecondaryIndexDescription
-> f GlobalSecondaryIndexDescription
globalSecondaryIndexDescription_provisionedThroughput = (GlobalSecondaryIndexDescription
 -> Maybe ProvisionedThroughputDescription)
-> (GlobalSecondaryIndexDescription
    -> Maybe ProvisionedThroughputDescription
    -> GlobalSecondaryIndexDescription)
-> Lens
     GlobalSecondaryIndexDescription
     GlobalSecondaryIndexDescription
     (Maybe ProvisionedThroughputDescription)
     (Maybe ProvisionedThroughputDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalSecondaryIndexDescription' {Maybe ProvisionedThroughputDescription
provisionedThroughput :: Maybe ProvisionedThroughputDescription
$sel:provisionedThroughput:GlobalSecondaryIndexDescription' :: GlobalSecondaryIndexDescription
-> Maybe ProvisionedThroughputDescription
provisionedThroughput} -> Maybe ProvisionedThroughputDescription
provisionedThroughput) (\s :: GlobalSecondaryIndexDescription
s@GlobalSecondaryIndexDescription' {} Maybe ProvisionedThroughputDescription
a -> GlobalSecondaryIndexDescription
s {$sel:provisionedThroughput:GlobalSecondaryIndexDescription' :: Maybe ProvisionedThroughputDescription
provisionedThroughput = Maybe ProvisionedThroughputDescription
a} :: GlobalSecondaryIndexDescription)

-- | The Amazon Resource Name (ARN) that uniquely identifies the index.
globalSecondaryIndexDescription_indexArn :: Lens.Lens' GlobalSecondaryIndexDescription (Prelude.Maybe Prelude.Text)
globalSecondaryIndexDescription_indexArn :: (Maybe Text -> f (Maybe Text))
-> GlobalSecondaryIndexDescription
-> f GlobalSecondaryIndexDescription
globalSecondaryIndexDescription_indexArn = (GlobalSecondaryIndexDescription -> Maybe Text)
-> (GlobalSecondaryIndexDescription
    -> Maybe Text -> GlobalSecondaryIndexDescription)
-> Lens
     GlobalSecondaryIndexDescription
     GlobalSecondaryIndexDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalSecondaryIndexDescription' {Maybe Text
indexArn :: Maybe Text
$sel:indexArn:GlobalSecondaryIndexDescription' :: GlobalSecondaryIndexDescription -> Maybe Text
indexArn} -> Maybe Text
indexArn) (\s :: GlobalSecondaryIndexDescription
s@GlobalSecondaryIndexDescription' {} Maybe Text
a -> GlobalSecondaryIndexDescription
s {$sel:indexArn:GlobalSecondaryIndexDescription' :: Maybe Text
indexArn = Maybe Text
a} :: GlobalSecondaryIndexDescription)

-- | The complete key schema for a global secondary index, which consists of
-- one or more pairs of attribute names and key types:
--
-- -   @HASH@ - partition key
--
-- -   @RANGE@ - sort key
--
-- The partition key of an item is also known as its /hash attribute/. The
-- term \"hash attribute\" derives from DynamoDB\'s usage of an internal
-- hash function to evenly distribute data items across partitions, based
-- on their partition key values.
--
-- The sort key of an item is also known as its /range attribute/. The term
-- \"range attribute\" derives from the way DynamoDB stores items with the
-- same partition key physically close together, in sorted order by the
-- sort key value.
globalSecondaryIndexDescription_keySchema :: Lens.Lens' GlobalSecondaryIndexDescription (Prelude.Maybe (Prelude.NonEmpty KeySchemaElement))
globalSecondaryIndexDescription_keySchema :: (Maybe (NonEmpty KeySchemaElement)
 -> f (Maybe (NonEmpty KeySchemaElement)))
-> GlobalSecondaryIndexDescription
-> f GlobalSecondaryIndexDescription
globalSecondaryIndexDescription_keySchema = (GlobalSecondaryIndexDescription
 -> Maybe (NonEmpty KeySchemaElement))
-> (GlobalSecondaryIndexDescription
    -> Maybe (NonEmpty KeySchemaElement)
    -> GlobalSecondaryIndexDescription)
-> Lens
     GlobalSecondaryIndexDescription
     GlobalSecondaryIndexDescription
     (Maybe (NonEmpty KeySchemaElement))
     (Maybe (NonEmpty KeySchemaElement))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalSecondaryIndexDescription' {Maybe (NonEmpty KeySchemaElement)
keySchema :: Maybe (NonEmpty KeySchemaElement)
$sel:keySchema:GlobalSecondaryIndexDescription' :: GlobalSecondaryIndexDescription
-> Maybe (NonEmpty KeySchemaElement)
keySchema} -> Maybe (NonEmpty KeySchemaElement)
keySchema) (\s :: GlobalSecondaryIndexDescription
s@GlobalSecondaryIndexDescription' {} Maybe (NonEmpty KeySchemaElement)
a -> GlobalSecondaryIndexDescription
s {$sel:keySchema:GlobalSecondaryIndexDescription' :: Maybe (NonEmpty KeySchemaElement)
keySchema = Maybe (NonEmpty KeySchemaElement)
a} :: GlobalSecondaryIndexDescription) ((Maybe (NonEmpty KeySchemaElement)
  -> f (Maybe (NonEmpty KeySchemaElement)))
 -> GlobalSecondaryIndexDescription
 -> f GlobalSecondaryIndexDescription)
-> ((Maybe (NonEmpty KeySchemaElement)
     -> f (Maybe (NonEmpty KeySchemaElement)))
    -> Maybe (NonEmpty KeySchemaElement)
    -> f (Maybe (NonEmpty KeySchemaElement)))
-> (Maybe (NonEmpty KeySchemaElement)
    -> f (Maybe (NonEmpty KeySchemaElement)))
-> GlobalSecondaryIndexDescription
-> f GlobalSecondaryIndexDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
-> Iso
     (Maybe (NonEmpty KeySchemaElement))
     (Maybe (NonEmpty KeySchemaElement))
     (Maybe (NonEmpty KeySchemaElement))
     (Maybe (NonEmpty KeySchemaElement))
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
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
  (NonEmpty KeySchemaElement)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Represents attributes that are copied (projected) from the table into
-- the global secondary index. These are in addition to the primary key
-- attributes and index key attributes, which are automatically projected.
globalSecondaryIndexDescription_projection :: Lens.Lens' GlobalSecondaryIndexDescription (Prelude.Maybe Projection)
globalSecondaryIndexDescription_projection :: (Maybe Projection -> f (Maybe Projection))
-> GlobalSecondaryIndexDescription
-> f GlobalSecondaryIndexDescription
globalSecondaryIndexDescription_projection = (GlobalSecondaryIndexDescription -> Maybe Projection)
-> (GlobalSecondaryIndexDescription
    -> Maybe Projection -> GlobalSecondaryIndexDescription)
-> Lens
     GlobalSecondaryIndexDescription
     GlobalSecondaryIndexDescription
     (Maybe Projection)
     (Maybe Projection)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalSecondaryIndexDescription' {Maybe Projection
projection :: Maybe Projection
$sel:projection:GlobalSecondaryIndexDescription' :: GlobalSecondaryIndexDescription -> Maybe Projection
projection} -> Maybe Projection
projection) (\s :: GlobalSecondaryIndexDescription
s@GlobalSecondaryIndexDescription' {} Maybe Projection
a -> GlobalSecondaryIndexDescription
s {$sel:projection:GlobalSecondaryIndexDescription' :: Maybe Projection
projection = Maybe Projection
a} :: GlobalSecondaryIndexDescription)

-- | The number of items in the specified index. DynamoDB updates this value
-- approximately every six hours. Recent changes might not be reflected in
-- this value.
globalSecondaryIndexDescription_itemCount :: Lens.Lens' GlobalSecondaryIndexDescription (Prelude.Maybe Prelude.Integer)
globalSecondaryIndexDescription_itemCount :: (Maybe Integer -> f (Maybe Integer))
-> GlobalSecondaryIndexDescription
-> f GlobalSecondaryIndexDescription
globalSecondaryIndexDescription_itemCount = (GlobalSecondaryIndexDescription -> Maybe Integer)
-> (GlobalSecondaryIndexDescription
    -> Maybe Integer -> GlobalSecondaryIndexDescription)
-> Lens
     GlobalSecondaryIndexDescription
     GlobalSecondaryIndexDescription
     (Maybe Integer)
     (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalSecondaryIndexDescription' {Maybe Integer
itemCount :: Maybe Integer
$sel:itemCount:GlobalSecondaryIndexDescription' :: GlobalSecondaryIndexDescription -> Maybe Integer
itemCount} -> Maybe Integer
itemCount) (\s :: GlobalSecondaryIndexDescription
s@GlobalSecondaryIndexDescription' {} Maybe Integer
a -> GlobalSecondaryIndexDescription
s {$sel:itemCount:GlobalSecondaryIndexDescription' :: Maybe Integer
itemCount = Maybe Integer
a} :: GlobalSecondaryIndexDescription)

-- | The name of the global secondary index.
globalSecondaryIndexDescription_indexName :: Lens.Lens' GlobalSecondaryIndexDescription (Prelude.Maybe Prelude.Text)
globalSecondaryIndexDescription_indexName :: (Maybe Text -> f (Maybe Text))
-> GlobalSecondaryIndexDescription
-> f GlobalSecondaryIndexDescription
globalSecondaryIndexDescription_indexName = (GlobalSecondaryIndexDescription -> Maybe Text)
-> (GlobalSecondaryIndexDescription
    -> Maybe Text -> GlobalSecondaryIndexDescription)
-> Lens
     GlobalSecondaryIndexDescription
     GlobalSecondaryIndexDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GlobalSecondaryIndexDescription' {Maybe Text
indexName :: Maybe Text
$sel:indexName:GlobalSecondaryIndexDescription' :: GlobalSecondaryIndexDescription -> Maybe Text
indexName} -> Maybe Text
indexName) (\s :: GlobalSecondaryIndexDescription
s@GlobalSecondaryIndexDescription' {} Maybe Text
a -> GlobalSecondaryIndexDescription
s {$sel:indexName:GlobalSecondaryIndexDescription' :: Maybe Text
indexName = Maybe Text
a} :: GlobalSecondaryIndexDescription)

instance
  Core.FromJSON
    GlobalSecondaryIndexDescription
  where
  parseJSON :: Value -> Parser GlobalSecondaryIndexDescription
parseJSON =
    String
-> (Object -> Parser GlobalSecondaryIndexDescription)
-> Value
-> Parser GlobalSecondaryIndexDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GlobalSecondaryIndexDescription"
      ( \Object
x ->
          Maybe Bool
-> Maybe Integer
-> Maybe IndexStatus
-> Maybe ProvisionedThroughputDescription
-> Maybe Text
-> Maybe (NonEmpty KeySchemaElement)
-> Maybe Projection
-> Maybe Integer
-> Maybe Text
-> GlobalSecondaryIndexDescription
GlobalSecondaryIndexDescription'
            (Maybe Bool
 -> Maybe Integer
 -> Maybe IndexStatus
 -> Maybe ProvisionedThroughputDescription
 -> Maybe Text
 -> Maybe (NonEmpty KeySchemaElement)
 -> Maybe Projection
 -> Maybe Integer
 -> Maybe Text
 -> GlobalSecondaryIndexDescription)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Integer
      -> Maybe IndexStatus
      -> Maybe ProvisionedThroughputDescription
      -> Maybe Text
      -> Maybe (NonEmpty KeySchemaElement)
      -> Maybe Projection
      -> Maybe Integer
      -> Maybe Text
      -> GlobalSecondaryIndexDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Backfilling")
            Parser
  (Maybe Integer
   -> Maybe IndexStatus
   -> Maybe ProvisionedThroughputDescription
   -> Maybe Text
   -> Maybe (NonEmpty KeySchemaElement)
   -> Maybe Projection
   -> Maybe Integer
   -> Maybe Text
   -> GlobalSecondaryIndexDescription)
-> Parser (Maybe Integer)
-> Parser
     (Maybe IndexStatus
      -> Maybe ProvisionedThroughputDescription
      -> Maybe Text
      -> Maybe (NonEmpty KeySchemaElement)
      -> Maybe Projection
      -> Maybe Integer
      -> Maybe Text
      -> GlobalSecondaryIndexDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IndexSizeBytes")
            Parser
  (Maybe IndexStatus
   -> Maybe ProvisionedThroughputDescription
   -> Maybe Text
   -> Maybe (NonEmpty KeySchemaElement)
   -> Maybe Projection
   -> Maybe Integer
   -> Maybe Text
   -> GlobalSecondaryIndexDescription)
-> Parser (Maybe IndexStatus)
-> Parser
     (Maybe ProvisionedThroughputDescription
      -> Maybe Text
      -> Maybe (NonEmpty KeySchemaElement)
      -> Maybe Projection
      -> Maybe Integer
      -> Maybe Text
      -> GlobalSecondaryIndexDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe IndexStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IndexStatus")
            Parser
  (Maybe ProvisionedThroughputDescription
   -> Maybe Text
   -> Maybe (NonEmpty KeySchemaElement)
   -> Maybe Projection
   -> Maybe Integer
   -> Maybe Text
   -> GlobalSecondaryIndexDescription)
-> Parser (Maybe ProvisionedThroughputDescription)
-> Parser
     (Maybe Text
      -> Maybe (NonEmpty KeySchemaElement)
      -> Maybe Projection
      -> Maybe Integer
      -> Maybe Text
      -> GlobalSecondaryIndexDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ProvisionedThroughputDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ProvisionedThroughput")
            Parser
  (Maybe Text
   -> Maybe (NonEmpty KeySchemaElement)
   -> Maybe Projection
   -> Maybe Integer
   -> Maybe Text
   -> GlobalSecondaryIndexDescription)
-> Parser (Maybe Text)
-> Parser
     (Maybe (NonEmpty KeySchemaElement)
      -> Maybe Projection
      -> Maybe Integer
      -> Maybe Text
      -> GlobalSecondaryIndexDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IndexArn")
            Parser
  (Maybe (NonEmpty KeySchemaElement)
   -> Maybe Projection
   -> Maybe Integer
   -> Maybe Text
   -> GlobalSecondaryIndexDescription)
-> Parser (Maybe (NonEmpty KeySchemaElement))
-> Parser
     (Maybe Projection
      -> Maybe Integer -> Maybe Text -> GlobalSecondaryIndexDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty KeySchemaElement))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"KeySchema")
            Parser
  (Maybe Projection
   -> Maybe Integer -> Maybe Text -> GlobalSecondaryIndexDescription)
-> Parser (Maybe Projection)
-> Parser
     (Maybe Integer -> Maybe Text -> GlobalSecondaryIndexDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Projection)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Projection")
            Parser
  (Maybe Integer -> Maybe Text -> GlobalSecondaryIndexDescription)
-> Parser (Maybe Integer)
-> Parser (Maybe Text -> GlobalSecondaryIndexDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ItemCount")
            Parser (Maybe Text -> GlobalSecondaryIndexDescription)
-> Parser (Maybe Text) -> Parser GlobalSecondaryIndexDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IndexName")
      )

instance
  Prelude.Hashable
    GlobalSecondaryIndexDescription

instance
  Prelude.NFData
    GlobalSecondaryIndexDescription