{-# 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.Glue.Types.BatchUpdatePartitionRequestEntry
-- 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.Glue.Types.BatchUpdatePartitionRequestEntry where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.PartitionInput
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A structure that contains the values and structure used to update a
-- partition.
--
-- /See:/ 'newBatchUpdatePartitionRequestEntry' smart constructor.
data BatchUpdatePartitionRequestEntry = BatchUpdatePartitionRequestEntry'
  { -- | A list of values defining the partitions.
    BatchUpdatePartitionRequestEntry -> [Text]
partitionValueList :: [Prelude.Text],
    -- | The structure used to update a partition.
    BatchUpdatePartitionRequestEntry -> PartitionInput
partitionInput :: PartitionInput
  }
  deriving (BatchUpdatePartitionRequestEntry
-> BatchUpdatePartitionRequestEntry -> Bool
(BatchUpdatePartitionRequestEntry
 -> BatchUpdatePartitionRequestEntry -> Bool)
-> (BatchUpdatePartitionRequestEntry
    -> BatchUpdatePartitionRequestEntry -> Bool)
-> Eq BatchUpdatePartitionRequestEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchUpdatePartitionRequestEntry
-> BatchUpdatePartitionRequestEntry -> Bool
$c/= :: BatchUpdatePartitionRequestEntry
-> BatchUpdatePartitionRequestEntry -> Bool
== :: BatchUpdatePartitionRequestEntry
-> BatchUpdatePartitionRequestEntry -> Bool
$c== :: BatchUpdatePartitionRequestEntry
-> BatchUpdatePartitionRequestEntry -> Bool
Prelude.Eq, ReadPrec [BatchUpdatePartitionRequestEntry]
ReadPrec BatchUpdatePartitionRequestEntry
Int -> ReadS BatchUpdatePartitionRequestEntry
ReadS [BatchUpdatePartitionRequestEntry]
(Int -> ReadS BatchUpdatePartitionRequestEntry)
-> ReadS [BatchUpdatePartitionRequestEntry]
-> ReadPrec BatchUpdatePartitionRequestEntry
-> ReadPrec [BatchUpdatePartitionRequestEntry]
-> Read BatchUpdatePartitionRequestEntry
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchUpdatePartitionRequestEntry]
$creadListPrec :: ReadPrec [BatchUpdatePartitionRequestEntry]
readPrec :: ReadPrec BatchUpdatePartitionRequestEntry
$creadPrec :: ReadPrec BatchUpdatePartitionRequestEntry
readList :: ReadS [BatchUpdatePartitionRequestEntry]
$creadList :: ReadS [BatchUpdatePartitionRequestEntry]
readsPrec :: Int -> ReadS BatchUpdatePartitionRequestEntry
$creadsPrec :: Int -> ReadS BatchUpdatePartitionRequestEntry
Prelude.Read, Int -> BatchUpdatePartitionRequestEntry -> ShowS
[BatchUpdatePartitionRequestEntry] -> ShowS
BatchUpdatePartitionRequestEntry -> String
(Int -> BatchUpdatePartitionRequestEntry -> ShowS)
-> (BatchUpdatePartitionRequestEntry -> String)
-> ([BatchUpdatePartitionRequestEntry] -> ShowS)
-> Show BatchUpdatePartitionRequestEntry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchUpdatePartitionRequestEntry] -> ShowS
$cshowList :: [BatchUpdatePartitionRequestEntry] -> ShowS
show :: BatchUpdatePartitionRequestEntry -> String
$cshow :: BatchUpdatePartitionRequestEntry -> String
showsPrec :: Int -> BatchUpdatePartitionRequestEntry -> ShowS
$cshowsPrec :: Int -> BatchUpdatePartitionRequestEntry -> ShowS
Prelude.Show, (forall x.
 BatchUpdatePartitionRequestEntry
 -> Rep BatchUpdatePartitionRequestEntry x)
-> (forall x.
    Rep BatchUpdatePartitionRequestEntry x
    -> BatchUpdatePartitionRequestEntry)
-> Generic BatchUpdatePartitionRequestEntry
forall x.
Rep BatchUpdatePartitionRequestEntry x
-> BatchUpdatePartitionRequestEntry
forall x.
BatchUpdatePartitionRequestEntry
-> Rep BatchUpdatePartitionRequestEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchUpdatePartitionRequestEntry x
-> BatchUpdatePartitionRequestEntry
$cfrom :: forall x.
BatchUpdatePartitionRequestEntry
-> Rep BatchUpdatePartitionRequestEntry x
Prelude.Generic)

-- |
-- Create a value of 'BatchUpdatePartitionRequestEntry' 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:
--
-- 'partitionValueList', 'batchUpdatePartitionRequestEntry_partitionValueList' - A list of values defining the partitions.
--
-- 'partitionInput', 'batchUpdatePartitionRequestEntry_partitionInput' - The structure used to update a partition.
newBatchUpdatePartitionRequestEntry ::
  -- | 'partitionInput'
  PartitionInput ->
  BatchUpdatePartitionRequestEntry
newBatchUpdatePartitionRequestEntry :: PartitionInput -> BatchUpdatePartitionRequestEntry
newBatchUpdatePartitionRequestEntry PartitionInput
pPartitionInput_ =
  BatchUpdatePartitionRequestEntry' :: [Text] -> PartitionInput -> BatchUpdatePartitionRequestEntry
BatchUpdatePartitionRequestEntry'
    { $sel:partitionValueList:BatchUpdatePartitionRequestEntry' :: [Text]
partitionValueList =
        [Text]
forall a. Monoid a => a
Prelude.mempty,
      $sel:partitionInput:BatchUpdatePartitionRequestEntry' :: PartitionInput
partitionInput = PartitionInput
pPartitionInput_
    }

-- | A list of values defining the partitions.
batchUpdatePartitionRequestEntry_partitionValueList :: Lens.Lens' BatchUpdatePartitionRequestEntry [Prelude.Text]
batchUpdatePartitionRequestEntry_partitionValueList :: ([Text] -> f [Text])
-> BatchUpdatePartitionRequestEntry
-> f BatchUpdatePartitionRequestEntry
batchUpdatePartitionRequestEntry_partitionValueList = (BatchUpdatePartitionRequestEntry -> [Text])
-> (BatchUpdatePartitionRequestEntry
    -> [Text] -> BatchUpdatePartitionRequestEntry)
-> Lens
     BatchUpdatePartitionRequestEntry
     BatchUpdatePartitionRequestEntry
     [Text]
     [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdatePartitionRequestEntry' {[Text]
partitionValueList :: [Text]
$sel:partitionValueList:BatchUpdatePartitionRequestEntry' :: BatchUpdatePartitionRequestEntry -> [Text]
partitionValueList} -> [Text]
partitionValueList) (\s :: BatchUpdatePartitionRequestEntry
s@BatchUpdatePartitionRequestEntry' {} [Text]
a -> BatchUpdatePartitionRequestEntry
s {$sel:partitionValueList:BatchUpdatePartitionRequestEntry' :: [Text]
partitionValueList = [Text]
a} :: BatchUpdatePartitionRequestEntry) (([Text] -> f [Text])
 -> BatchUpdatePartitionRequestEntry
 -> f BatchUpdatePartitionRequestEntry)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> BatchUpdatePartitionRequestEntry
-> f BatchUpdatePartitionRequestEntry
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The structure used to update a partition.
batchUpdatePartitionRequestEntry_partitionInput :: Lens.Lens' BatchUpdatePartitionRequestEntry PartitionInput
batchUpdatePartitionRequestEntry_partitionInput :: (PartitionInput -> f PartitionInput)
-> BatchUpdatePartitionRequestEntry
-> f BatchUpdatePartitionRequestEntry
batchUpdatePartitionRequestEntry_partitionInput = (BatchUpdatePartitionRequestEntry -> PartitionInput)
-> (BatchUpdatePartitionRequestEntry
    -> PartitionInput -> BatchUpdatePartitionRequestEntry)
-> Lens
     BatchUpdatePartitionRequestEntry
     BatchUpdatePartitionRequestEntry
     PartitionInput
     PartitionInput
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchUpdatePartitionRequestEntry' {PartitionInput
partitionInput :: PartitionInput
$sel:partitionInput:BatchUpdatePartitionRequestEntry' :: BatchUpdatePartitionRequestEntry -> PartitionInput
partitionInput} -> PartitionInput
partitionInput) (\s :: BatchUpdatePartitionRequestEntry
s@BatchUpdatePartitionRequestEntry' {} PartitionInput
a -> BatchUpdatePartitionRequestEntry
s {$sel:partitionInput:BatchUpdatePartitionRequestEntry' :: PartitionInput
partitionInput = PartitionInput
a} :: BatchUpdatePartitionRequestEntry)

instance
  Prelude.Hashable
    BatchUpdatePartitionRequestEntry

instance
  Prelude.NFData
    BatchUpdatePartitionRequestEntry

instance Core.ToJSON BatchUpdatePartitionRequestEntry where
  toJSON :: BatchUpdatePartitionRequestEntry -> Value
toJSON BatchUpdatePartitionRequestEntry' {[Text]
PartitionInput
partitionInput :: PartitionInput
partitionValueList :: [Text]
$sel:partitionInput:BatchUpdatePartitionRequestEntry' :: BatchUpdatePartitionRequestEntry -> PartitionInput
$sel:partitionValueList:BatchUpdatePartitionRequestEntry' :: BatchUpdatePartitionRequestEntry -> [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
"PartitionValueList" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
partitionValueList),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"PartitionInput" Text -> PartitionInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PartitionInput
partitionInput)
          ]
      )