{-# 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.Pinpoint.Types.EndpointBatchRequest
-- 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.Pinpoint.Types.EndpointBatchRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types.EndpointBatchItem
import qualified Amazonka.Prelude as Prelude

-- | Specifies a batch of endpoints to create or update and the settings and
-- attributes to set or change for each endpoint.
--
-- /See:/ 'newEndpointBatchRequest' smart constructor.
data EndpointBatchRequest = EndpointBatchRequest'
  { -- | An array that defines the endpoints to create or update and, for each
    -- endpoint, the property values to set or change. An array can contain a
    -- maximum of 100 items.
    EndpointBatchRequest -> [EndpointBatchItem]
item :: [EndpointBatchItem]
  }
  deriving (EndpointBatchRequest -> EndpointBatchRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointBatchRequest -> EndpointBatchRequest -> Bool
$c/= :: EndpointBatchRequest -> EndpointBatchRequest -> Bool
== :: EndpointBatchRequest -> EndpointBatchRequest -> Bool
$c== :: EndpointBatchRequest -> EndpointBatchRequest -> Bool
Prelude.Eq, ReadPrec [EndpointBatchRequest]
ReadPrec EndpointBatchRequest
Int -> ReadS EndpointBatchRequest
ReadS [EndpointBatchRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointBatchRequest]
$creadListPrec :: ReadPrec [EndpointBatchRequest]
readPrec :: ReadPrec EndpointBatchRequest
$creadPrec :: ReadPrec EndpointBatchRequest
readList :: ReadS [EndpointBatchRequest]
$creadList :: ReadS [EndpointBatchRequest]
readsPrec :: Int -> ReadS EndpointBatchRequest
$creadsPrec :: Int -> ReadS EndpointBatchRequest
Prelude.Read, Int -> EndpointBatchRequest -> ShowS
[EndpointBatchRequest] -> ShowS
EndpointBatchRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointBatchRequest] -> ShowS
$cshowList :: [EndpointBatchRequest] -> ShowS
show :: EndpointBatchRequest -> String
$cshow :: EndpointBatchRequest -> String
showsPrec :: Int -> EndpointBatchRequest -> ShowS
$cshowsPrec :: Int -> EndpointBatchRequest -> ShowS
Prelude.Show, forall x. Rep EndpointBatchRequest x -> EndpointBatchRequest
forall x. EndpointBatchRequest -> Rep EndpointBatchRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointBatchRequest x -> EndpointBatchRequest
$cfrom :: forall x. EndpointBatchRequest -> Rep EndpointBatchRequest x
Prelude.Generic)

-- |
-- Create a value of 'EndpointBatchRequest' 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:
--
-- 'item', 'endpointBatchRequest_item' - An array that defines the endpoints to create or update and, for each
-- endpoint, the property values to set or change. An array can contain a
-- maximum of 100 items.
newEndpointBatchRequest ::
  EndpointBatchRequest
newEndpointBatchRequest :: EndpointBatchRequest
newEndpointBatchRequest =
  EndpointBatchRequest' {$sel:item:EndpointBatchRequest' :: [EndpointBatchItem]
item = forall a. Monoid a => a
Prelude.mempty}

-- | An array that defines the endpoints to create or update and, for each
-- endpoint, the property values to set or change. An array can contain a
-- maximum of 100 items.
endpointBatchRequest_item :: Lens.Lens' EndpointBatchRequest [EndpointBatchItem]
endpointBatchRequest_item :: Lens' EndpointBatchRequest [EndpointBatchItem]
endpointBatchRequest_item = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointBatchRequest' {[EndpointBatchItem]
item :: [EndpointBatchItem]
$sel:item:EndpointBatchRequest' :: EndpointBatchRequest -> [EndpointBatchItem]
item} -> [EndpointBatchItem]
item) (\s :: EndpointBatchRequest
s@EndpointBatchRequest' {} [EndpointBatchItem]
a -> EndpointBatchRequest
s {$sel:item:EndpointBatchRequest' :: [EndpointBatchItem]
item = [EndpointBatchItem]
a} :: EndpointBatchRequest) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable EndpointBatchRequest where
  hashWithSalt :: Int -> EndpointBatchRequest -> Int
hashWithSalt Int
_salt EndpointBatchRequest' {[EndpointBatchItem]
item :: [EndpointBatchItem]
$sel:item:EndpointBatchRequest' :: EndpointBatchRequest -> [EndpointBatchItem]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [EndpointBatchItem]
item

instance Prelude.NFData EndpointBatchRequest where
  rnf :: EndpointBatchRequest -> ()
rnf EndpointBatchRequest' {[EndpointBatchItem]
item :: [EndpointBatchItem]
$sel:item:EndpointBatchRequest' :: EndpointBatchRequest -> [EndpointBatchItem]
..} = forall a. NFData a => a -> ()
Prelude.rnf [EndpointBatchItem]
item

instance Data.ToJSON EndpointBatchRequest where
  toJSON :: EndpointBatchRequest -> Value
toJSON EndpointBatchRequest' {[EndpointBatchItem]
item :: [EndpointBatchItem]
$sel:item:EndpointBatchRequest' :: EndpointBatchRequest -> [EndpointBatchItem]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Item" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [EndpointBatchItem]
item)]
      )