{-# 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.DeleteGlobalSecondaryIndexAction
-- 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.DeleteGlobalSecondaryIndexAction where

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

-- | Represents a global secondary index to be deleted from an existing
-- table.
--
-- /See:/ 'newDeleteGlobalSecondaryIndexAction' smart constructor.
data DeleteGlobalSecondaryIndexAction = DeleteGlobalSecondaryIndexAction'
  { -- | The name of the global secondary index to be deleted.
    DeleteGlobalSecondaryIndexAction -> Text
indexName :: Prelude.Text
  }
  deriving (DeleteGlobalSecondaryIndexAction
-> DeleteGlobalSecondaryIndexAction -> Bool
(DeleteGlobalSecondaryIndexAction
 -> DeleteGlobalSecondaryIndexAction -> Bool)
-> (DeleteGlobalSecondaryIndexAction
    -> DeleteGlobalSecondaryIndexAction -> Bool)
-> Eq DeleteGlobalSecondaryIndexAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteGlobalSecondaryIndexAction
-> DeleteGlobalSecondaryIndexAction -> Bool
$c/= :: DeleteGlobalSecondaryIndexAction
-> DeleteGlobalSecondaryIndexAction -> Bool
== :: DeleteGlobalSecondaryIndexAction
-> DeleteGlobalSecondaryIndexAction -> Bool
$c== :: DeleteGlobalSecondaryIndexAction
-> DeleteGlobalSecondaryIndexAction -> Bool
Prelude.Eq, ReadPrec [DeleteGlobalSecondaryIndexAction]
ReadPrec DeleteGlobalSecondaryIndexAction
Int -> ReadS DeleteGlobalSecondaryIndexAction
ReadS [DeleteGlobalSecondaryIndexAction]
(Int -> ReadS DeleteGlobalSecondaryIndexAction)
-> ReadS [DeleteGlobalSecondaryIndexAction]
-> ReadPrec DeleteGlobalSecondaryIndexAction
-> ReadPrec [DeleteGlobalSecondaryIndexAction]
-> Read DeleteGlobalSecondaryIndexAction
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteGlobalSecondaryIndexAction]
$creadListPrec :: ReadPrec [DeleteGlobalSecondaryIndexAction]
readPrec :: ReadPrec DeleteGlobalSecondaryIndexAction
$creadPrec :: ReadPrec DeleteGlobalSecondaryIndexAction
readList :: ReadS [DeleteGlobalSecondaryIndexAction]
$creadList :: ReadS [DeleteGlobalSecondaryIndexAction]
readsPrec :: Int -> ReadS DeleteGlobalSecondaryIndexAction
$creadsPrec :: Int -> ReadS DeleteGlobalSecondaryIndexAction
Prelude.Read, Int -> DeleteGlobalSecondaryIndexAction -> ShowS
[DeleteGlobalSecondaryIndexAction] -> ShowS
DeleteGlobalSecondaryIndexAction -> String
(Int -> DeleteGlobalSecondaryIndexAction -> ShowS)
-> (DeleteGlobalSecondaryIndexAction -> String)
-> ([DeleteGlobalSecondaryIndexAction] -> ShowS)
-> Show DeleteGlobalSecondaryIndexAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteGlobalSecondaryIndexAction] -> ShowS
$cshowList :: [DeleteGlobalSecondaryIndexAction] -> ShowS
show :: DeleteGlobalSecondaryIndexAction -> String
$cshow :: DeleteGlobalSecondaryIndexAction -> String
showsPrec :: Int -> DeleteGlobalSecondaryIndexAction -> ShowS
$cshowsPrec :: Int -> DeleteGlobalSecondaryIndexAction -> ShowS
Prelude.Show, (forall x.
 DeleteGlobalSecondaryIndexAction
 -> Rep DeleteGlobalSecondaryIndexAction x)
-> (forall x.
    Rep DeleteGlobalSecondaryIndexAction x
    -> DeleteGlobalSecondaryIndexAction)
-> Generic DeleteGlobalSecondaryIndexAction
forall x.
Rep DeleteGlobalSecondaryIndexAction x
-> DeleteGlobalSecondaryIndexAction
forall x.
DeleteGlobalSecondaryIndexAction
-> Rep DeleteGlobalSecondaryIndexAction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteGlobalSecondaryIndexAction x
-> DeleteGlobalSecondaryIndexAction
$cfrom :: forall x.
DeleteGlobalSecondaryIndexAction
-> Rep DeleteGlobalSecondaryIndexAction x
Prelude.Generic)

-- |
-- Create a value of 'DeleteGlobalSecondaryIndexAction' 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:
--
-- 'indexName', 'deleteGlobalSecondaryIndexAction_indexName' - The name of the global secondary index to be deleted.
newDeleteGlobalSecondaryIndexAction ::
  -- | 'indexName'
  Prelude.Text ->
  DeleteGlobalSecondaryIndexAction
newDeleteGlobalSecondaryIndexAction :: Text -> DeleteGlobalSecondaryIndexAction
newDeleteGlobalSecondaryIndexAction Text
pIndexName_ =
  DeleteGlobalSecondaryIndexAction' :: Text -> DeleteGlobalSecondaryIndexAction
DeleteGlobalSecondaryIndexAction'
    { $sel:indexName:DeleteGlobalSecondaryIndexAction' :: Text
indexName =
        Text
pIndexName_
    }

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

instance
  Prelude.Hashable
    DeleteGlobalSecondaryIndexAction

instance
  Prelude.NFData
    DeleteGlobalSecondaryIndexAction

instance Core.ToJSON DeleteGlobalSecondaryIndexAction where
  toJSON :: DeleteGlobalSecondaryIndexAction -> Value
toJSON DeleteGlobalSecondaryIndexAction' {Text
indexName :: Text
$sel:indexName:DeleteGlobalSecondaryIndexAction' :: DeleteGlobalSecondaryIndexAction -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IndexName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
indexName)]
      )